From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A9622453D for ; Wed, 9 Aug 2023 20:21:01 +0000 (UTC) Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [IPv6:2a0a:51c0:0:237:300::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9714110E9; Wed, 9 Aug 2023 13:21:00 -0700 (PDT) Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1qTpfq-0001c2-Gy; Wed, 09 Aug 2023 22:20:54 +0200 Date: Wed, 9 Aug 2023 22:20:54 +0200 From: Florian Westphal To: Justin Stitt Cc: Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-hardening@vger.kernel.org, Kees Cook , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 7/7] netfilter: xtables: refactor deprecated strncpy Message-ID: <20230809202054.GC3325@breakpoint.cc> References: <20230809-net-netfilter-v2-0-5847d707ec0a@google.com> <20230809-net-netfilter-v2-7-5847d707ec0a@google.com> Precedence: bulk X-Mailing-List: netdev@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: <20230809-net-netfilter-v2-7-5847d707ec0a@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Justin Stitt wrote: > Prefer `strscpy_pad` as it's a more robust interface whilst maintaing > zero-padding behavior. > > 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. I don't think we need to use _pad here.