From: Florian Westphal <fw@strlen.de>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: "Florian Westphal" <fw@strlen.de>,
netfilter-devel@vger.kernel.org,
"Maciej Żenczykowski" <zenczykowski@gmail.com>
Subject: Re: [PATCH v2 nft] parser: tcpopt: fix tcp option parsing with NUM + length field
Date: Tue, 5 Dec 2023 14:14:48 +0100 [thread overview]
Message-ID: <20231205131448.GB13832@breakpoint.cc> (raw)
In-Reply-To: <ZW8cgUtUjMGS/apR@calendula>
Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> On Tue, Dec 05, 2023 at 01:20:26PM +0100, Florian Westphal wrote:
> > Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> > > > if (!desc) {
> > > > - if (field != TCPOPT_COMMON_KIND || kind > 255)
> > > > + if (kind > 255)
> > > > return NULL;
> > >
> > > Another suggestion: Remove this NULL, it leaves lhs as NULL in the
> > > relational. kind > 255 cannot ever happen, parser rejects numbers over
> > > 255.
> >
> > We can also feed this via input from udata (typeof).
> > So I'd rather not assert() or rely on bison checks.
>
> OK, but then NULL does not help either, that will crash on evaluation too.
>
> You could narrow down kind and field in tcpopt_expr_alloc() to uint8_t.
Unfortunately, no. 'kind' is overloaded, SACK blocks 1/2/3/4 use values
gt 255, see TCPOPT_KIND_SACK3 at end of enum tcpopt_kind.
next prev parent reply other threads:[~2023-12-05 13:14 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-05 11:56 [PATCH v2 nft] parser: tcpopt: fix tcp option parsing with NUM + length field Florian Westphal
2023-12-05 12:07 ` Pablo Neira Ayuso
2023-12-05 12:20 ` Florian Westphal
2023-12-05 12:50 ` Pablo Neira Ayuso
2023-12-05 13:14 ` Florian Westphal [this message]
2023-12-05 14:10 ` Pablo Neira Ayuso
2023-12-06 7:58 ` Thomas Haller
2023-12-06 11:38 ` Florian Westphal
2023-12-06 11:50 ` Thomas Haller
2023-12-06 11:59 ` Florian Westphal
2023-12-06 12:04 ` Florian Westphal
2023-12-06 12:09 ` Thomas Haller
2023-12-06 12:16 ` Florian Westphal
2023-12-06 13:22 ` Thomas Haller
2023-12-06 13:24 ` Florian Westphal
2023-12-06 14:56 ` Thomas Haller
2023-12-06 14:19 ` Phil Sutter
2023-12-06 15:12 ` Thomas Haller
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=20231205131448.GB13832@breakpoint.cc \
--to=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=zenczykowski@gmail.com \
/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 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).