txtinfo: ensure null termination of string buffer
authorFerry Huberts <ferry.huberts@pelagic.nl>
Fri, 24 Oct 2014 07:51:41 +0000 (09:51 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Fri, 24 Oct 2014 07:55:55 +0000 (09:55 +0200)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/txtinfo/src/olsrd_txtinfo.c

index 02bd00a..23479d0 100644 (file)
@@ -567,6 +567,7 @@ static void sgw_ipvx(struct autobuf *abuf, bool ipv6, const char * fmth, const c
 
           inet_ntop(ipv6 ? AF_INET6 : AF_INET, &gw->gw->originator, originator, sizeof(originator));
           strncpy(prefix, olsr_ip_prefix_to_string(&gw->gw->external_prefix), sizeof(prefix));
+          prefix[sizeof(prefix) - 1] = '\0';
           uplink = gw->gw->uplink;
           downlink = gw->gw->downlink;
           pc = tc ?tc->path_cost : ROUTE_COST_BROKEN;