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>
This commit is contained in:
Kees Cook 2013-07-03 15:09:08 -07:00 коммит произвёл Linus Torvalds
Родитель 94ac11833f
Коммит 8da01af45e
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -272,7 +272,7 @@ int main(int argc, char *argv[])
char *logfile = NULL; char *logfile = NULL;
int loop = 0; int loop = 0;
int containerset = 0; int containerset = 0;
char containerpath[1024]; char *containerpath = NULL;
int cfd = 0; int cfd = 0;
int forking = 0; int forking = 0;
sigset_t sigset; sigset_t sigset;
@ -299,7 +299,7 @@ int main(int argc, char *argv[])
break; break;
case 'C': case 'C':
containerset = 1; containerset = 1;
strncpy(containerpath, optarg, strlen(optarg) + 1); containerpath = optarg;
break; break;
case 'w': case 'w':
logfile = strdup(optarg); logfile = strdup(optarg);