D Dave Seddon #
Message details and related content
addattr_l() leaves up to three alignment bytes unchanged. Zero them in the helper so padding does not depend on the caller's buffer contents, matching addraw_l() and rta_addattr_l(). Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Dave Seddon <redacted> --- Follow-up offered in the rta_addattr_l() v2 notes: https://lore.kernel.org/netdev/20261109164116.2637408-1-dave.seddon.ca@gmail.com/ lib/libnetlink.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index c4a8e694..23fbf5f1 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c@@ -1414,6 +1414,7 @@ int addattr_l(struct nlmsghdr *n, int maxlen, int type, const void *data, rta->rta_len = len; if (alen) memcpy(RTA_DATA(rta), data, alen); + memset((void *)rta + len, 0, RTA_ALIGN(len) - len); n->nlmsg_len = NLMSG_ALIGN(n->nlmsg_len) + RTA_ALIGN(len); return 0; }
--
2.56.0