sparc: kernel: using strlcpy() instead of strcpy()
'boot_command_line' and 'full_boot_str' has a fix length, 'cmdline_p' and 'boot_command' maybe larger than them. So use strlcpy() instead of strcpy() to avoid memory overflow. Signed-off-by: Zhao Hongjiang <zhaohongjiang@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
242ece22f0
commit
117a0c5fc9
@@ -843,7 +843,8 @@ void ldom_reboot(const char *boot_command)
|
||||
unsigned long len;
|
||||
|
||||
strcpy(full_boot_str, "boot ");
|
||||
strcpy(full_boot_str + strlen("boot "), boot_command);
|
||||
strlcpy(full_boot_str + strlen("boot "), boot_command,
|
||||
sizeof(full_boot_str + strlen("boot ")));
|
||||
len = strlen(full_boot_str);
|
||||
|
||||
if (reboot_data_supported) {
|
||||
|
Reference in New Issue
Block a user