Commit 5c19adb2 authored by Kees Cook's avatar Kees Cook Committed by Greg Kroah-Hartman

sparc: fix ldom_reboot buffer overflow harder

[ Upstream commit 20928bd3 ]

The length argument to strlcpy was still wrong. It could overflow the end of
full_boot_str by 5 bytes. Instead of strcat and strlcpy, just use snprint.
Reported-by: default avatarBrad Spengler <spender@grsecurity.net>
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 34b6bdb2
...@@ -842,9 +842,8 @@ void ldom_reboot(const char *boot_command) ...@@ -842,9 +842,8 @@ void ldom_reboot(const char *boot_command)
if (boot_command && strlen(boot_command)) { if (boot_command && strlen(boot_command)) {
unsigned long len; unsigned long len;
strcpy(full_boot_str, "boot "); snprintf(full_boot_str, sizeof(full_boot_str), "boot %s",
strlcpy(full_boot_str + strlen("boot "), boot_command, boot_command);
sizeof(full_boot_str));
len = strlen(full_boot_str); len = strlen(full_boot_str);
if (reboot_data_supported) { if (reboot_data_supported) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment