Skip to content

Commit

Permalink
Documentation/accounting/getdelays.c: avoid strncpy in accounting tool
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kees Cook authored and Linus Torvalds committed Jul 3, 2013
1 parent 94ac118 commit 8da01af
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Documentation/accounting/getdelays.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ int main(int argc, char *argv[])
char *logfile = NULL;
int loop = 0;
int containerset = 0;
char containerpath[1024];
char *containerpath = NULL;
int cfd = 0;
int forking = 0;
sigset_t sigset;
Expand All @@ -299,7 +299,7 @@ int main(int argc, char *argv[])
break;
case 'C':
containerset = 1;
strncpy(containerpath, optarg, strlen(optarg) + 1);
containerpath = optarg;
break;
case 'w':
logfile = strdup(optarg);
Expand Down

0 comments on commit 8da01af

Please sign in to comment.