]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
confile_legacy: prevent null pointer deref
authorChristian Brauner <christian.brauner@ubuntu.com>
Mon, 4 Dec 2017 00:38:01 +0000 (01:38 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Fri, 15 Dec 2017 11:42:32 +0000 (12:42 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/confile_legacy.c

index eb956dd40944bf53a0e5625a25ca47743544033b..9fc2c06c932399caa0fdc94e1f21d5f4200541b5 100644 (file)
@@ -969,7 +969,7 @@ static int lxc_clear_nic(struct lxc_conf *c, const char *key)
 
        p1 = strchr(key, '.');
        if (!p1 || *(p1+1) == '\0')
-               p1 = NULL;
+               return -1;
 
        if (!p1 && it) {
                lxc_remove_nic(it);
@@ -987,8 +987,9 @@ static int lxc_clear_nic(struct lxc_conf *c, const char *key)
                        free(it2->elem);
                        free(it2);
                }
+       } else {
+               return -1;
        }
-       else return -1;
 
        return 0;
 }