Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 20928bd3 authored by Kees Cook's avatar Kees Cook Committed by David S. Miller
Browse files

sparc: fix ldom_reboot buffer overflow harder



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>
parent c31eeace
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -849,9 +849,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) {