diff options
author | David S. Miller <davem@davemloft.net> | 2013-09-27 16:46:04 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-09-27 16:46:04 -0400 |
commit | 2bd161a605f1f84a5fc8a4fe8410113a94f79355 (patch) | |
tree | 2a5bdbe12f328d0bbb7345a61aa35ca4916bb021 /arch/sparc | |
parent | 6cac446bd37d9381815fe4c2b0e7b1fd1085000c (diff) |
sparc64: Fix buggy strlcpy() conversion in ldom_reboot().
Commit 117a0c5fc9c2d06045bd217385b2b39ea426b5a6 ("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: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc')
-rw-r--r-- | arch/sparc/kernel/ds.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/sparc/kernel/ds.c b/arch/sparc/kernel/ds.c index 62d6b153ffa2..4d9ac8406f32 100644 --- a/arch/sparc/kernel/ds.c +++ b/arch/sparc/kernel/ds.c | |||
@@ -851,7 +851,7 @@ void ldom_reboot(const char *boot_command) | |||
851 | 851 | ||
852 | strcpy(full_boot_str, "boot "); | 852 | strcpy(full_boot_str, "boot "); |
853 | strlcpy(full_boot_str + strlen("boot "), boot_command, | 853 | strlcpy(full_boot_str + strlen("boot "), boot_command, |
854 | sizeof(full_boot_str + strlen("boot "))); | 854 | sizeof(full_boot_str)); |
855 | len = strlen(full_boot_str); | 855 | len = strlen(full_boot_str); |
856 | 856 | ||
857 | if (reboot_data_supported) { | 857 | if (reboot_data_supported) { |