archive mirror
 help / color / mirror / Atom feed
From: Daniel Wagner <>
Cc: Daniel Wagner <>
Subject: [PATCH v1 0/2] Fix -Werror=array-bounds errors
Date: Tue, 22 Jun 2021 09:49:31 +0200	[thread overview]
Message-ID: <> (raw)

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(-)


             reply	other threads:[~2021-06-22  7:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-22  7:49 Daniel Wagner [this message]
2021-06-22  7:49 ` [PATCH v1 1/2] rtnl: Fix netlink message alignment Daniel Wagner
2021-06-22  7:49 ` [PATCH v1 2/2] vpn-rtnl: " Daniel Wagner
2021-06-23  7:38 ` [PATCH v1 0/2] Fix -Werror=array-bounds errors Daniel Wagner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).