[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20260113114127.36386-1-jvaclav@redhat.com>
Date: Tue, 13 Jan 2026 12:41:27 +0100
From: Jan Vaclav <jvaclav@...hat.com>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: netdev@...r.kernel.org,
Jan Vaclav <jvaclav@...hat.com>,
Gris Ge <fge@...hat.com>
Subject: [PATCH iproute2] ip/iplink: fix off-by-one KIND length in modify()
The expected size for IFLA_INFO_KIND in kernel is strlen(kind) + 1.
See `size` in rtnl_link_get_size() in net/core/rtnetlink.c.
Fixes: 1d93483985f0 ("iplink: use netlink for link configuration")
Reported-by: Gris Ge <fge@...hat.com>
Signed-off-by: Jan Vaclav <jvaclav@...hat.com>
---
ip/iplink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ip/iplink.c b/ip/iplink.c
index 59e8caf4..fce6631d 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -1139,7 +1139,7 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv)
linkinfo = addattr_nest(&req.n, sizeof(req), IFLA_LINKINFO);
addattr_l(&req.n, sizeof(req), IFLA_INFO_KIND, type,
- strlen(type));
+ strlen(type) + 1);
lu = get_link_kind(type);
if (ulinep && !strcmp(ulinep, "_slave"))
--
2.51.0
Powered by blists - more mailing lists