diff options
author | Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se> | 2014-06-23 16:22:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-23 19:47:44 -0400 |
commit | 88e15ce402c58f41037752da092683e90826742a (patch) | |
tree | 1e20d014a7e31b2ffe1347384533ef928e61429a | |
parent | b6226b45c66196e14ef628d3aead2139700db1ad (diff) |
Documentation/accounting/getdelays.c: add missing null-terminate after strncpy call
Added a guaranteed null-terminate after call to strncpy.
This was partly found using a static code analysis program called
cppcheck.
Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | Documentation/accounting/getdelays.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c index c6a06b71594d..f40578026a04 100644 --- a/Documentation/accounting/getdelays.c +++ b/Documentation/accounting/getdelays.c | |||
@@ -314,6 +314,7 @@ int main(int argc, char *argv[]) | |||
314 | break; | 314 | break; |
315 | case 'm': | 315 | case 'm': |
316 | strncpy(cpumask, optarg, sizeof(cpumask)); | 316 | strncpy(cpumask, optarg, sizeof(cpumask)); |
317 | cpumask[sizeof(cpumask) - 1] = '\0'; | ||
317 | maskset = 1; | 318 | maskset = 1; |
318 | printf("cpumask %s maskset %d\n", cpumask, maskset); | 319 | printf("cpumask %s maskset %d\n", cpumask, maskset); |
319 | break; | 320 | break; |