[ovs-dev] [PATCH] lib: Fix off-by-one error in route-table.

Ethan Jackson ethan at nicira.com
Tue Feb 1 07:32:40 UTC 2011


---
 lib/route-table.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/route-table.c b/lib/route-table.c
index 29d81bb..64a5c1e 100644
--- a/lib/route-table.c
+++ b/lib/route-table.c
@@ -446,7 +446,7 @@ name_table_reset(void)
             nn = xzalloc(sizeof *nn);
             nn->ifi_index = change.ifi_index;
             strncpy(nn->ifname, change.ifname, IFNAMSIZ);
-            nn->ifname[IFNAMSIZ] = '\0';
+            nn->ifname[IFNAMSIZ - 1] = '\0';
             hmap_insert(&name_map, &nn->node, hash_int(nn->ifi_index, 0));
         }
     }
-- 
1.7.2





More information about the dev mailing list