Received: by 2002:a05:6358:51dd:b0:131:369:b2a3 with SMTP id 29csp234061rwl; Wed, 9 Aug 2023 13:45:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE8W4pt4RAewAINjBp7kNxApqb1nF1bNgYpcSXNTIEPuV6gOhdROEVJtm7/XFYmYNZ82gAi X-Received: by 2002:aa7:d28e:0:b0:522:1bdd:d41a with SMTP id w14-20020aa7d28e000000b005221bddd41amr262019edq.4.1691613932033; Wed, 09 Aug 2023 13:45:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691613932; cv=none; d=google.com; s=arc-20160816; b=s7z+DqknA9HnH4cPKnHRfUhGtIpTDD31FgacJ5gIjjkFOXLn9U5bFfG6D5lRpyIYX6 Zb+of9+a2Brgr/1haoZrvQFMmxuzMl3nS9of918PfJVGmXKUP+ucYHVuEdbbNuOUiVrV Y7qSeRJNL4EBAIu5onu1rvcJnLLYO5y5GVp4GMmDqmH+jcu7DoBy16CfwP6hCjRPBg/c BqVDjQkDvDCPGC3HOvRIaYCuGUnJsD1PijByixi0OyGIY2//8koTOX7O3IrLFEyA2rFQ s61OvWi5iB7htDx3GXo9VNzSjdR+QZYYQGSsBL6cvBbwhH8rJ+HQw2Rbce38BNqbsX+P 1zrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=sGAVaacTNMKpocPnHc3ZUjwL2yZzpIuXbGGKTn7Xldk=; fh=q+idgjsNOfSeB0DE+ldLVkxZV9h+m6OLm8KWzgZjrCg=; b=VUlYc/+tfuVhs124Jt/Nhc/meix+Ry+WTKEr7Sho1nHO4NICwuiGeRPEEwFgnQ4NIr JAONMC7Ipw33zpaA3xHguLsTme9/tH7FlNsDh0180ZIPhTS4rkS6cUuVxR6BUAJMTFUF ecbZXrlL4/uPQ+dhw0UpnV0J2+pnm/EHXESSBypRffsNNkAjZuFo3QLo7xFFWXmPXEfZ 0Ddgw81IVEY8BBAHHKQPte3z+tXbCD/f4/ih7peqWZaFnqo1sRtXPJAwZjfLJv66CxlM Gu1AIcvwu0VxUmCFMdnBVY0sRegkn3G7NTupOlX6RtF8TK29GyP89owpoLuFwXTp7eCo ZxLA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r14-20020aa7da0e000000b005222c4ef218si9701098eds.298.2023.08.09.13.45.07; Wed, 09 Aug 2023 13:45:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232528AbjHIUVB (ORCPT + 99 others); Wed, 9 Aug 2023 16:21:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229543AbjHIUVA (ORCPT ); Wed, 9 Aug 2023 16:21:00 -0400 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> 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.