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

Commit 2bd161a6 authored by David S. Miller's avatar David S. Miller
Browse files

sparc64: Fix buggy strlcpy() conversion in ldom_reboot().



Commit 117a0c5f ("sparc: kernel: using
strlcpy() instead of strcpy()") added a bug to ldom_reboot in
arch/sparc/kernel/ds.c

-		strcpy(full_boot_str + strlen("boot "), boot_command);
+				     strlcpy(full_boot_str + strlen("boot "), boot_command,
+				     			     sizeof(full_boot_str + strlen("boot ")));

That last sizeof() expression evaluates to sizeof(size_t) which is
not what was intended.

Also even the corrected:

     sizeof(full_boot_str) + strlen("boot ")

is not right as the destination buffer length is just plain
"sizeof(full_boot_str)" and that's what the final argument
should be.

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6cac446b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -851,7 +851,7 @@ void ldom_reboot(const char *boot_command)

		strcpy(full_boot_str, "boot ");
		strlcpy(full_boot_str + strlen("boot "), boot_command,
			sizeof(full_boot_str + strlen("boot ")));
			sizeof(full_boot_str));
		len = strlen(full_boot_str);

		if (reboot_data_supported) {