Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Documentation/accounting/getdelays.c: avoid strncpy in accounting tool

Avoid strncpy anti-pattern.

[akpm@linux-foundation.org: remove the str[cpy|dup] altogether]
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Andreas Schwab <schwab@linux-m68k.org>
Cc: Rob Landley <rob@landley.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Kees Cook and committed by
Linus Torvalds
8da01af4 94ac1183

+2 -2
+2 -2
Documentation/accounting/getdelays.c
··· 272 272 char *logfile = NULL; 273 273 int loop = 0; 274 274 int containerset = 0; 275 - char containerpath[1024]; 275 + char *containerpath = NULL; 276 276 int cfd = 0; 277 277 int forking = 0; 278 278 sigset_t sigset; ··· 299 299 break; 300 300 case 'C': 301 301 containerset = 1; 302 - strncpy(containerpath, optarg, strlen(optarg) + 1); 302 + containerpath = optarg; 303 303 break; 304 304 case 'w': 305 305 logfile = strdup(optarg);