]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Fix crasher in get_ips
authorStéphane Graber <stgraber@ubuntu.com>
Sun, 29 Sep 2013 23:41:52 +0000 (19:41 -0400)
committerStéphane Graber <stgraber@ubuntu.com>
Sun, 29 Sep 2013 23:41:52 +0000 (19:41 -0400)
Check that the interface structure is not NULL before trying to access
its members.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/lxccontainer.c

index 1b3f2f5fc72f02a1192973720d9b6977d9377fa1..3a2ae92a42251189811d5c3508b361d9c37313d6 100644 (file)
@@ -1305,6 +1305,9 @@ static char** lxcapi_get_ips(struct lxc_container *c, char* interface, char* fam
 
        /* Iterate through the interfaces */
        for (tempIfAddr = interfaceArray; tempIfAddr != NULL; tempIfAddr = tempIfAddr->ifa_next) {
+               if (tempIfAddr->ifa_addr == NULL)
+                       continue;
+
                if(tempIfAddr->ifa_addr->sa_family == AF_INET) {
                        if (family && strcmp(family, "inet"))
                                continue;