libnetlink: zero padding in addattr_l()
Subsystems (3)
PATCH 1/1 libnetlink: zero padding in addattr_l()
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 <[email protected]>
---
Follow-up offered in the rta_addattr_l() v2 notes:
https://lore.kernel.org/netdev/[email protected]/
lib/libnetlink.c | 1 + 1 file changed, 1 insertion(+)
lib/libnetlink.c +1 -0
@@ -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 ; }
Signature · 1 line
2.56.0
This patch was applied to iproute2/iproute2.git (main) by Stephen Hemminger <[email protected]>:
Hello:
This patch was applied to iproute2/iproute2.git (main) by Stephen Hemminger <[email protected]>:
Quoted 8 lines · On Mon, 9 Nov 2026 15:23:54 -0800 you wrote:
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, matchingaddraw_l()andrta_addattr_l().Assisted-by Claude:claude-opus-5-5Signed-off-by Dave Seddon <[email protected]>[...]
Here is the summary with links:
- [iproute2] libnetlink: zero padding in addattr_l()
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=104413f986e9
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html