Skip to content

Commit 8da01af

Browse files
keestorvalds
authored andcommitted
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>
1 parent 94ac118 commit 8da01af

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎Documentation/accounting/getdelays.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ int main(int argc, char *argv[])
272272
char *logfile = NULL;
273273
int loop = 0;
274274
int containerset = 0;
275-
char containerpath[1024];
275+
char *containerpath = NULL;
276276
int cfd = 0;
277277
int forking = 0;
278278
sigset_t sigset;
@@ -299,7 +299,7 @@ int main(int argc, char *argv[])
299299
break;
300300
case 'C':
301301
containerset = 1;
302-
strncpy(containerpath, optarg, strlen(optarg) + 1);
302+
containerpath = optarg;
303303
break;
304304
case 'w':
305305
logfile = strdup(optarg);

0 commit comments

Comments
 (0)