]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
Documentation/accounting/getdelays.c: avoid strncpy in accounting tool
authorKees Cook <keescook@chromium.org>
Wed, 3 Jul 2013 22:09:08 +0000 (15:09 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 3 Jul 2013 23:08:06 +0000 (16:08 -0700)
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>
Documentation/accounting/getdelays.c

index f8ebcde43b174640ae1ab1d8ac47426a10688614..c6a06b71594d4726ed6cfe5577dbaeda8cba1bb0 100644 (file)
@@ -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);