]> git.proxmox.com Git - mirror_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>
Fri, 14 Jun 2019 10:39:20 +0000 (12:39 +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 189d92088fa53988dcfb20ccd37c0fc540ed07ef..0a78adc2088e024feec1fbcc190f5815ddcf61a8 100644 (file)
@@ -1160,8 +1160,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);