From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH libftnl 08/12] src: set: clear field_len array before copying
Date: Wed, 28 Oct 2026 15:56:28 +0100 [thread overview]
Message-ID: <20261028145632.7089-9-fw@strlen.de> (raw)
In-Reply-To: <20261028145632.7089-1-fw@strlen.de>
LLM flagged:
if (data_len > sizeof(s->desc.field_len))
return -1;
memcpy(&s->desc.field_len, data, data_len);
for (s->desc.field_count = 0;
s->desc.field_count < NFT_REG32_COUNT;
s->desc.field_count++) {
if (!s->desc.field_len[s->desc.field_count]) // here
i.e. it relies on the inital zero state.
If for any reason a 2nd call is made that shinks field_len
array, the loop would read stale count from previous
incarnation.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
src/set.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/set.c b/src/set.c
index 22fd4a839f80..fc50f3f28055 100644
--- a/src/set.c
+++ b/src/set.c
@@ -188,6 +188,7 @@ int nftnl_set_set_data(struct nftnl_set *s, uint16_t attr, const void *data,
if (data_len > sizeof(s->desc.field_len))
return -1;
+ memset(&s->desc.field_len, 0, sizeof(s->desc.field_len));
memcpy(&s->desc.field_len, data, data_len);
for (s->desc.field_count = 0;
s->desc.field_count < NFT_REG32_COUNT;
--
2.55.0
next prev parent reply other threads:[~2026-10-28 14:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 14:56 [PATCH libftnl 00/12] more misc LLM fixes Florian Westphal
2026-10-28 14:56 ` [PATCH libftnl 01/12] src: common: mnl_nlmsg_batch_start may return NULL Florian Westphal
2026-10-28 14:56 ` [PATCH libftnl 02/12] src: fix uninitialised attr arrays Florian Westphal
2026-10-28 14:56 ` [PATCH libftnl 03/12] src: move several MNL_STRING types to MNL_NUL_STRING Florian Westphal
2026-10-28 14:56 ` [PATCH libftnl 04/12] src: expr: make sure NFTA_EXPR_NAME was parsed successfuly Florian Westphal
2026-10-28 14:56 ` [PATCH libftnl 05/12] src: object: don't permit to re-set or clear object type field Florian Westphal
2026-10-28 14:56 ` [PATCH libftnl 06/12] include: drop semicolon at end of xfree macro Florian Westphal
2026-10-28 14:56 ` [PATCH libftnl 07/12] src: ruleset: remove set_elem member from union Florian Westphal
2026-10-28 14:56 ` Florian Westphal [this message]
2026-10-29 17:17 ` [PATCH libftnl 08/12] src: set: clear field_len array before copying Phil Sutter
2026-10-28 14:56 ` [PATCH libftnl 09/12] src: set: check for empty list explicitly Florian Westphal
2026-10-28 14:56 ` [PATCH libftnl 10/12] src: set_elem: list_del before freeing Florian Westphal
2026-10-28 14:56 ` [PATCH libftnl 11/12] src: udata: clamp buf->end to actally copied size Florian Westphal
2026-10-28 14:56 ` [PATCH libftnl 12/12] src: remove all remaining MNL_STRING users Florian Westphal
2026-10-29 17:19 ` [PATCH libftnl 00/12] more misc LLM fixes Phil Sutter
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261028145632.7089-9-fw@strlen.de \
--to=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* 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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.