Skip to content

Commit eb43efd

Browse files
tobluxGreg Ungerer
authored andcommitted
m68k: Replace memcpy() + manual NUL-termination with strscpy()
Use strscpy() to safely copy the command-line string instead of memcpy() followed by a manual NUL-termination. The source string is also NUL-terminated and meets the __must_be_cstr() requirement of strscpy(). No functional changes intended. Signed-off-by: Thorsten Blum <[email protected]> Signed-off-by: Greg Ungerer <[email protected]>
1 parent 245bb7b commit eb43efd

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

arch/m68k/kernel/setup_no.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,7 @@ void __init setup_arch(char **cmdline_p)
145145

146146
/* Keep a copy of command line */
147147
*cmdline_p = &command_line[0];
148-
memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
149-
boot_command_line[COMMAND_LINE_SIZE-1] = 0;
148+
strscpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
150149

151150
/*
152151
* Give all the memory to the bootmap allocator, tell it to put the

0 commit comments

Comments
 (0)