[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <35rnr776-4ssp-314r-0473-p19q3r880ps1@vanv.qr>
Date: Wed, 9 Aug 2023 01:20:34 +0200 (CEST)
From: Jan Engelhardt <jengelh@...i.de>
To: Justin Stitt <justinstitt@...gle.com>
cc: Pablo Neira Ayuso <pablo@...filter.org>,
Jozsef Kadlecsik <kadlec@...filter.org>, Florian Westphal <fw@...len.de>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, linux-hardening@...r.kernel.org,
Kees Cook <keescook@...omium.org>, netfilter-devel@...r.kernel.org,
coreteam@...filter.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 7/7] netfilter: xtables: refactor deprecated strncpy
On Wednesday 2023-08-09 00:48, Justin Stitt wrote:
>Prefer `strscpy` as it's a more robust interface.
>
>There may have existed a bug here due to both `tbl->repl.name` and
>`info->name` having a size of 32 as defined below:
>| #define XT_TABLE_MAXNAMELEN 32
>
>This may lead to buffer overreads in some situations -- `strscpy` solves
>this by guaranteeing NUL-termination of the dest buffer.
It generally will not lead to overreads.
xt not only deals with strings on its own turf, it even takes
them from userspace-provided buffers, which means extra scrutiny is
absolutely required. Done in places like
x_tables.c: if (strnlen(name, XT_EXTENSION_MAXNAMELEN) == XT_EXTENSION_MAXNAMELEN)
(Which is not to say the strncpy->strscpy mop-up is bad.)
Powered by blists - more mailing lists