From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH libftnl 04/12] src: expr: make sure NFTA_EXPR_NAME was parsed successfuly
Date: Wed, 28 Oct 2026 15:56:24 +0100 [thread overview]
Message-ID: <20261028145632.7089-5-fw@strlen.de> (raw)
In-Reply-To: <20261028145632.7089-1-fw@strlen.de>
LLM finding. Not a bug atm, the kernel always includes this.
While at it, upgrade to NUL_STRING. Kernel always sets a trailing
NUL even for NLA_STRING, so we can enforce this.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
src/expr.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/expr.c b/src/expr.c
index 6462119e3eb2..980b317ff6db 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -251,7 +251,7 @@ static int nftnl_rule_parse_expr_cb(const struct nlattr *attr, void *data)
switch (type) {
case NFTA_EXPR_NAME:
- if (mnl_attr_validate(attr, MNL_TYPE_STRING) < 0)
+ if (mnl_attr_validate(attr, MNL_TYPE_NUL_STRING) < 0)
abi_breakage();
break;
case NFTA_EXPR_DATA:
@@ -272,6 +272,9 @@ struct nftnl_expr *nftnl_expr_parse(struct nlattr *attr)
if (mnl_attr_parse_nested(attr, nftnl_rule_parse_expr_cb, tb) < 0)
goto err1;
+ if (!tb[NFTA_EXPR_NAME])
+ goto err1;
+
expr = nftnl_expr_alloc(mnl_attr_get_str(tb[NFTA_EXPR_NAME]));
if (expr == NULL)
goto err1;
--
2.55.0
next prev parent reply other threads:[~2026-10-28 14:57 UTC|newest]
Thread overview: 16+ 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 ` Florian Westphal [this message]
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 ` [PATCH libftnl 08/12] src: set: clear field_len array before copying Florian Westphal
2026-10-29 17:17 ` 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
2026-10-30 9:16 ` Fernando Fernandez Mancera
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-5-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.