From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [IPv6:2a0a:51c0:0:237:300::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CC72C9 for ; Tue, 5 Dec 2023 04:20:28 -0800 (PST) Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1rAUPa-00082S-Ut; Tue, 05 Dec 2023 13:20:26 +0100 Date: Tue, 5 Dec 2023 13:20:26 +0100 From: Florian Westphal To: Pablo Neira Ayuso Cc: Florian Westphal , netfilter-devel@vger.kernel.org, Maciej =?utf-8?Q?=C5=BBenczykowski?= Subject: Re: [PATCH v2 nft] parser: tcpopt: fix tcp option parsing with NUM + length field Message-ID: <20231205122026.GA13832@breakpoint.cc> References: <20231205115610.19791-1-fw@strlen.de> Precedence: bulk X-Mailing-List: netfilter-devel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Pablo Neira Ayuso 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.