]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
network: fix lxc_netdev_rename_by_index()
authorChristian Brauner <christian.brauner@ubuntu.com>
Fri, 14 Jun 2019 10:39:20 +0000 (12:39 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Tue, 18 Jun 2019 19:13:09 +0000 (21:13 +0200)
Return an error code when the name is invalid instead of pretending that things
are fine.

Closes #3044.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/network.c

index ca82eda7f910132bbac9ce890266e24a15f1af34..fb8260cffc8c6347c3bdb4adc6b1495cd7cd772f 100644 (file)
@@ -858,8 +858,10 @@ int lxc_netdev_rename_by_index(int ifindex, const char *newname)
                return err;
 
        len = strlen(newname);
-       if (len == 1 || len >= IFNAMSIZ)
+       if (len == 1 || len >= IFNAMSIZ) {
+               err = -EINVAL;
                goto out;
+       }
 
        err = -ENOMEM;
        nlmsg = nlmsg_alloc(NLMSG_GOOD_SIZE);