Fix illegal memory access
authorSteven Barth <steven@midlink.org>
Tue, 15 Oct 2013 15:18:20 +0000 (17:18 +0200)
committerSteven Barth <steven@midlink.org>
Tue, 15 Oct 2013 15:18:20 +0000 (17:18 +0200)
src/config.c

index 7700c7e..5d29173 100644 (file)
@@ -287,7 +287,9 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr
        if (!iface->ifname[0] && !ifname)
                return -1;
 
-       strncpy(iface->ifname, ifname, sizeof(iface->ifname) - 1);
+       if (ifname)
+               strncpy(iface->ifname, ifname, sizeof(iface->ifname) - 1);
+
        iface->inuse = true;
 
        if (overwrite)