All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: fw@strlen.de, fmancera@suse.de
Subject: [PATCH nf-next 2/4] netfilter: xt_CT: check for nul-terminated timeout and helper name
Date: Tue, 18 Aug 2026 14:27:39 +0200	[thread overview]
Message-ID: <20260818122741.1329660-2-pablo@netfilter.org> (raw)
In-Reply-To: <20260818122741.1329660-1-pablo@netfilter.org>

Otherwise, ignore malformed helper/timeout string that userspace
provides.

Fixes: 84f3bb9ae9db ("netfilter: xtables: add CT target")
Fixes: 24de58f46516 ("netfilter: xt_CT: allow to attach timeout policy + glue code")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/xt_CT.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/xt_CT.c b/net/netfilter/xt_CT.c
index e78660dfdf4b..91326014ade1 100644
--- a/net/netfilter/xt_CT.c
+++ b/net/netfilter/xt_CT.c
@@ -195,7 +195,8 @@ static int xt_ct_tg_check(const struct xt_tgchk_param *par,
 		goto err3;
 	}
 
-	if (info->helper[0]) {
+	if (info->helper[0] &&
+	    strnlen(info->helper, sizeof(info->helper)) < sizeof(info->helper)) {
 		if (strnlen(info->helper, sizeof(info->helper)) == sizeof(info->helper)) {
 			ret = -ENAMETOOLONG;
 			goto err3;
@@ -206,7 +207,8 @@ static int xt_ct_tg_check(const struct xt_tgchk_param *par,
 			goto err3;
 	}
 
-	if (info->timeout[0]) {
+	if (info->timeout[0] &&
+	    strnlen(info->timeout, sizeof(info->timeout)) < sizeof(info->timeout)) {
 		if (strnlen(info->timeout, sizeof(info->timeout)) == sizeof(info->timeout)) {
 			ret = -ENAMETOOLONG;
 			goto err4;
-- 
2.47.3


  reply	other threads:[~2026-08-18 12:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-18 12:27 [PATCH nf-next 1/4] netfilter: x_tables: remove pr_debug in matches/targets Pablo Neira Ayuso
2026-08-18 12:27 ` Pablo Neira Ayuso [this message]
2026-08-18 12:27 ` [PATCH nf-next 3/4] netfilter: x_tables: do not print specified table Pablo Neira Ayuso
2026-08-18 12:55   ` Jan Engelhardt
2026-08-18 14:08     ` Pablo Neira Ayuso
2026-08-18 12:27 ` [PATCH nf-next 4/4] netfilter: xt_cgroup: use pr_info_ratelimited() Pablo Neira Ayuso
2026-08-18 12:47   ` Florian Westphal
2026-08-18 12:54   ` Fernando Fernandez Mancera
2026-08-18 13:10 ` [PATCH nf-next 1/4] netfilter: x_tables: remove pr_debug in matches/targets Florian Westphal

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=20260818122741.1329660-2-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=fmancera@suse.de \
    --cc=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.