aboutsummaryrefslogtreecommitdiff
path: root/arch/sparc
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2013-10-01 22:13:34 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-10-13 16:08:32 -0700
commit5c19adb25bc8d618619c24c4500bbbbc06bdba0b (patch)
treef7aed10573f88b45fed25ebb0bf74199e0f6c5e9 /arch/sparc
parent34b6bdb2a889231e450774b5227a80c2f5051bc0 (diff)
sparc: fix ldom_reboot buffer overflow harder
[ Upstream commit 20928bd3f08afb036c096d9559d581926b895918 ] 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: Brad Spengler <spender@grsecurity.net> Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/sparc')
-rw-r--r--arch/sparc/kernel/ds.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/arch/sparc/kernel/ds.c b/arch/sparc/kernel/ds.c
index c129cc93aa4..252f8768aac 100644
--- a/arch/sparc/kernel/ds.c
+++ b/arch/sparc/kernel/ds.c
@@ -842,9 +842,8 @@ void ldom_reboot(const char *boot_command)
if (boot_command && strlen(boot_command)) {
unsigned long len;
- strcpy(full_boot_str, "boot ");
- strlcpy(full_boot_str + strlen("boot "), boot_command,
- sizeof(full_boot_str));
+ snprintf(full_boot_str, sizeof(full_boot_str), "boot %s",
+ boot_command);
len = strlen(full_boot_str);
if (reboot_data_supported) {