Properly copy interface name if unknown.

We use a static string if the interface name is unknown, so using memcpy
with IFNAMSIZ is incorrect as that would overrun the static string.
This commit is contained in:
Tobias Brunner
2011-04-19 13:48:50 +02:00
parent 82017bf417
commit f526b35c45
@@ -350,7 +350,7 @@ static void process_link(private_kernel_netlink_net_t *this,
entry->addrs = linked_list_create();
this->ifaces->insert_last(this->ifaces, entry);
}
memcpy(entry->ifname, name, IFNAMSIZ);
strncpy(entry->ifname, name, IFNAMSIZ);
entry->ifname[IFNAMSIZ-1] = '\0';
if (event)
{