From: Pablo Neira Ayuso <pablo@netfilter.org>
To: David Dull <monderasdor@gmail.com>
Cc: netfilter-devel@vger.kernel.org, fw@strlen.de
Subject: Re: [PATCH v3] netfilter: guard option walkers against 1-byte tail reads
Date: Sun, 8 Mar 2026 18:05:07 +0100 [thread overview]
Message-ID: <aa2sQ7XhMGV7nPC2@chamomile> (raw)
In-Reply-To: <20260308155212.1437-1-monderasdor@gmail.com>
On Sun, Mar 08, 2026 at 05:52:11PM +0200, David Dull wrote:
> When the last byte of options is a non-single-byte option kind, walkers
> that advance with i += op[i + 1] ? : 1 can read op[i + 1] past the end
> of the option area.
>
> Handle single-byte options first, then check that a length byte is still
> available before reading op[i + 1] in xt_tcpudp and xt_dccp option
> walkers.
>
> Fixes: 2e4e6a17af35 ("[NETFILTER] x_tables: Abstraction layer for {ip,ip6,arp}_tables")
> Cc: stable@vger.kernel.org
> Signed-off-by: David Dull <monderasdor@gmail.com>
> ---
> net/netfilter/xt_dccp.c | 8 ++++++--
> net/netfilter/xt_tcpudp.c | 8 ++++++--
> 2 files changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/net/netfilter/xt_dccp.c b/net/netfilter/xt_dccp.c
> index e5a13ecbe6..7f9e2d5c1b 100644
> --- a/net/netfilter/xt_dccp.c
> +++ b/net/netfilter/xt_dccp.c
> @@ -62,10 +62,14 @@ dccp_find_option(u_int8_t option,
> return true;
> }
>
> - if (op[i] < 2 || i == optlen - 1)
> + if (op[i] < 2) {
> i++;
> - else
> + continue;
> + }
> +
> + if (i + 1 >= optlen)
> + break;
> +
> i += op[i + 1] ? : 1;
This indent is wrong, I posted this patch:
https://patchwork.ozlabs.org/project/netfilter-devel/patch/20260308112510.2958551-1-pablo@netfilter.org/
prev parent reply other threads:[~2026-03-08 17:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-07 18:26 [PATCH] netfilter: guard option walkers against 1-byte tail reads David Dull
2026-03-07 18:34 ` Florian Westphal
2026-03-07 18:45 ` [PATCH v2] " David Dull
2026-03-08 11:11 ` Pablo Neira Ayuso
2026-03-08 15:52 ` [PATCH v3] " David Dull
2026-03-08 17:05 ` Pablo Neira Ayuso [this message]
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=aa2sQ7XhMGV7nPC2@chamomile \
--to=pablo@netfilter.org \
--cc=fw@strlen.de \
--cc=monderasdor@gmail.com \
--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.