]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Properly copy interface name if unknown.
authorTobias Brunner <tobias@strongswan.org>
Mon, 18 Apr 2011 14:10:36 +0000 (16:10 +0200)
committerTobias Brunner <tobias@strongswan.org>
Tue, 19 Apr 2011 11:48:50 +0000 (13:48 +0200)
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.

src/libhydra/plugins/kernel_netlink/kernel_netlink_net.c

index 6d0a567809410383c0a57840737231fca90a083d..8315ed31091b4c71c73d8b0ea92950dc1a5efea6 100644 (file)
@@ -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)
                        {