Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753349Ab3FJVVV (ORCPT ); Mon, 10 Jun 2013 17:21:21 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:59755 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752485Ab3FJVVT (ORCPT ); Mon, 10 Jun 2013 17:21:19 -0400 Date: Mon, 10 Jun 2013 14:21:18 -0700 From: Andrew Morton To: Kees Cook Cc: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: Re: [PATCH] doc: avoid strncpy in accounting tool Message-Id: <20130610142118.e5a3eb91c02f4185da99cd2c@linux-foundation.org> In-Reply-To: <20130606024930.GA24279@www.outflux.net> References: <20130606024930.GA24279@www.outflux.net> X-Mailer: Sylpheed 3.2.0beta5 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1417 Lines: 41 On Wed, 5 Jun 2013 19:49:30 -0700 Kees Cook wrote: > Avoid strncpy anti-pattern. Use strdup() instead, as already done for > the logfile optarg. > What Andreas said :) From: Andrew Morton Subject: documentation-accounting-getdelaysc-avoid-strncpy-in-accounting-tool-fix remove the str[cpy|dup] altogether Cc: Andreas Schwab Cc: Kees Cook Cc: Rob Landley Signed-off-by: Andrew Morton --- Documentation/accounting/getdelays.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff -puN Documentation/accounting/getdelays.c~documentation-accounting-getdelaysc-avoid-strncpy-in-accounting-tool-fix Documentation/accounting/getdelays.c --- a/Documentation/accounting/getdelays.c~documentation-accounting-getdelaysc-avoid-strncpy-in-accounting-tool-fix +++ a/Documentation/accounting/getdelays.c @@ -299,7 +299,7 @@ int main(int argc, char *argv[]) break; case 'C': containerset = 1; - containerpath = strdup(optarg); + containerpath = optarg; break; case 'w': logfile = strdup(optarg); _ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/