[RTNETLINK]: Fix netdevice name corruption
authorPatrick McHardy <kaber@trash.net>
Thu, 14 Sep 2006 03:35:36 +0000 (20:35 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Fri, 22 Sep 2006 22:18:50 +0000 (15:18 -0700)
When changing a device by ifindex without including a IFLA_IFNAME
attribute, the ifname variable contains random garbage and is used
to change the device name.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/rtnetlink.c

index 63b882ac288adf525081725d3360b1444a8673ec..d8e25e08cb7e7b725b3cc5cfb6e34cdf67a11532 100644 (file)
@@ -394,6 +394,8 @@ static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
 
        if (tb[IFLA_IFNAME])
                nla_strlcpy(ifname, tb[IFLA_IFNAME], IFNAMSIZ);
+       else
+               ifname[0] = '\0';
 
        err = -EINVAL;
        ifm = nlmsg_data(nlh);