From: Christian Brauner Date: Fri, 14 Jun 2019 10:39:20 +0000 (+0200) Subject: network: fix lxc_netdev_rename_by_index() X-Git-Tag: lxc-3.2.0~28^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=90d79629cb2180f6c70c47c9790fbaf8e577ab42;p=thirdparty%2Flxc.git network: fix lxc_netdev_rename_by_index() Return an error code when the name is invalid instead of pretending that things are fine. Closes #3044. Signed-off-by: Christian Brauner --- diff --git a/src/lxc/network.c b/src/lxc/network.c index 189d92088..0a78adc20 100644 --- a/src/lxc/network.c +++ b/src/lxc/network.c @@ -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);