Since commit 625df645b703 (Check user supplied interface name lengths) iplink_parse() validates network device name using check_ifname() helpers.
Remove redundant "name" length checks from iplink_parse() callers. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/iplink_vxcan.c | 8 +++----- ip/link_veth.c | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/ip/iplink_vxcan.c b/ip/iplink_vxcan.c index 680f640..c13224c 100644 --- a/ip/iplink_vxcan.c +++ b/ip/iplink_vxcan.c @@ -38,7 +38,7 @@ static int vxcan_parse_opt(struct link_util *lu, int argc, char **argv, char *link = NULL; char *type = NULL; int index = 0; - int err, len; + int err; struct rtattr *data; int group; struct ifinfomsg *ifm, *peer_ifm; @@ -66,10 +66,8 @@ static int vxcan_parse_opt(struct link_util *lu, int argc, char **argv, return err; if (name) { - len = strlen(name) + 1; - if (len > IFNAMSIZ) - invarg("\"name\" too long\n", *argv); - addattr_l(hdr, 1024, IFLA_IFNAME, name, len); + addattr_l(hdr, 1024, + IFLA_IFNAME, name, strlen(name) + 1); } peer_ifm = RTA_DATA(data); diff --git a/ip/link_veth.c b/ip/link_veth.c index a368827..fcfd1ef 100644 --- a/ip/link_veth.c +++ b/ip/link_veth.c @@ -36,7 +36,7 @@ static int veth_parse_opt(struct link_util *lu, int argc, char **argv, char *link = NULL; char *type = NULL; int index = 0; - int err, len; + int err; struct rtattr *data; int group; struct ifinfomsg *ifm, *peer_ifm; @@ -64,10 +64,8 @@ static int veth_parse_opt(struct link_util *lu, int argc, char **argv, return err; if (name) { - len = strlen(name) + 1; - if (len > IFNAMSIZ) - invarg("\"name\" too long\n", *argv); - addattr_l(hdr, 1024, IFLA_IFNAME, name, len); + addattr_l(hdr, 1024, + IFLA_IFNAME, name, strlen(name) + 1); } peer_ifm = RTA_DATA(data); -- 1.7.10.4