]> git.baikalelectronics.ru Git - kernel.git/commit
nios2: force the string buffer NULL-terminated
authorWang Xiayang <xywang.sjtu@sjtu.edu.cn>
Fri, 20 Sep 2019 06:55:47 +0000 (14:55 +0800)
committerLey Foon Tan <ley.foon.tan@intel.com>
Fri, 20 Sep 2019 06:55:57 +0000 (14:55 +0800)
commit77b13fb012f7711567423ea0c430a4fa8f0d2716
treeb1063a99689b528be795a82943bbdf97ab69869a
parent0bb5ce63238eccb0193eb43176ec1ea6a0abdbf9
nios2: force the string buffer NULL-terminated

strncpy() does not ensure NULL-termination when the input string
size equals to the destination buffer size COMMAND_LINE_SIZE.
Besides, grep under arch/ with 'boot_command_line' shows
no other arch-specific code uses strncpy() when copying
boot_command_line.

Use strlcpy() instead.

This issue is identified by a Coccinelle script.

Signed-off-by: Wang Xiayang <xywang.sjtu@sjtu.edu.cn>
Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
arch/nios2/kernel/setup.c