Skip to content

Fix -Werror=array-bounds errors

Daniel Wagner connman 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2rtnl: Fix netlink message alignmentsrc/rtnl.c+62 -630 replies
2/2vpn-rtnl: Fix netlink message alignmentvpn/vpn-rtnl.c+62 -630 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH v1 0/2] Fix -Werror=array-bounds errors

gcc complains with

src/rtnl.c: In function ‘send_getlink’:
src/rtnl.c:1485:12: error: array subscript ‘struct rtnl_request[0]’ is partly outside array bounds of ‘unsigned char[17]’ [-Werror=array-bounds]
1485 | req->hdr.nlmsg_len = RTNL_REQUEST_SIZE;
| ^~

The netlink helper 'struct rtnl_request' doesn't include any padding between header and message. This is wrong. Fix this by removing the helper structure and open code the message generation.

Daniel Wagner (2):
rtnl: Fix netlink message alignment
vpn-rtnl: Fix netlink message alignment

 src/rtnl.c     | 125 ++++++++++++++++++++++++-------------------------
 vpn/vpn-rtnl.c | 125 ++++++++++++++++++++++++-------------------------
 2 files changed, 124 insertions(+), 126 deletions(-)
Signature · 1 line
2.32.0