Skip to content

Commit

Permalink
Documentation/accounting/getdelays.c: add missing null-terminate afte…
Browse files Browse the repository at this point in the history
…r 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>
  • Loading branch information
Rickard Strandqvist authored and torvalds committed Jun 23, 2014
1 parent b6226b4 commit 88e15ce
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Documentation/accounting/getdelays.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ int main(int argc, char *argv[])
break;
case 'm':
strncpy(cpumask, optarg, sizeof(cpumask));
cpumask[sizeof(cpumask) - 1] = '\0';
maskset = 1;
printf("cpumask %s maskset %d\n", cpumask, maskset);
break;
Expand Down

0 comments on commit 88e15ce

Please sign in to comment.