lkml.org 
[lkml]   [2013]   [Jun]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] doc: avoid strncpy in accounting tool
On Wed, 5 Jun 2013 19:49:30 -0700 Kees Cook <keescook@chromium.org> wrote:

> Avoid strncpy anti-pattern. Use strdup() instead, as already done for
> the logfile optarg.
>

What Andreas said :)

From: Andrew Morton <akpm@linux-foundation.org>
Subject: documentation-accounting-getdelaysc-avoid-strncpy-in-accounting-tool-fix

remove the str[cpy|dup] altogether

Cc: Andreas Schwab <schwab@linux-m68k.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Rob Landley <rob@landley.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

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);
_


\
 
 \ /
  Last update: 2013-06-10 23:41    [W:0.050 / U:1.704 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site