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>
This commit is contained in:
Родитель
b6226b45c6
Коммит
88e15ce402
|
@ -314,6 +314,7 @@ int main(int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
strncpy(cpumask, optarg, sizeof(cpumask));
|
strncpy(cpumask, optarg, sizeof(cpumask));
|
||||||
|
cpumask[sizeof(cpumask) - 1] = '\0';
|
||||||
maskset = 1;
|
maskset = 1;
|
||||||
printf("cpumask %s maskset %d\n", cpumask, maskset);
|
printf("cpumask %s maskset %d\n", cpumask, maskset);
|
||||||
break;
|
break;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче