From: Kees Cook Date: Wed, 3 Jul 2013 22:09:08 +0000 (-0700) Subject: Documentation/accounting/getdelays.c: avoid strncpy in accounting tool X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8da01af45e197110cbce84fb5ccb54645f051ac6;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git 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 Cc: Andreas Schwab Cc: Rob Landley Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c index f8ebcde43b17..c6a06b71594d 100644 --- a/Documentation/accounting/getdelays.c +++ b/Documentation/accounting/getdelays.c @@ -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; @@ -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);