Skip to content

Commit fdd932e

Browse files
azeemshaikh38kees
authored andcommitted
of/flattree: Replace all non-returning strlcpy with strscpy
strlcpy() reads the entire source buffer first. This read may exceed the destination size limit. This is both inefficient and can lead to linear read overflows if a source string is not NUL-terminated [1]. In an effort to remove strlcpy() completely [2], replace strlcpy() here with strscpy(). No return values were used, so direct replacement is safe. [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy [2] KSPP#89 Signed-off-by: Azeem Shaikh <[email protected]> Reviewed-by: Kees Cook <[email protected]> Signed-off-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent bb07972 commit fdd932e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/microblaze/kernel/prom.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ void __init early_init_devtree(void *params)
2020

2121
early_init_dt_scan(params);
2222
if (!strlen(boot_command_line))
23-
strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
23+
strscpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
2424

2525
memblock_allow_resize();
2626

0 commit comments

Comments
 (0)