Commit e9a24eb
init/main.c: Fix potential static_command_line memory overflow
BugLink: https://bugs.launchpad.net/bugs/2067959
commit 46dad3c upstream.
We allocate memory of size 'xlen + strlen(boot_command_line) + 1' for
static_command_line, but the strings copied into static_command_line are
extra_command_line and command_line, rather than extra_command_line and
boot_command_line.
When strlen(command_line) > strlen(boot_command_line), static_command_line
will overflow.
This patch just recovers strlen(command_line) which was miss-consolidated
with strlen(boot_command_line) in the commit f5c7310 ("init/main: add
checks for the return value of memblock_alloc*()")
Link: https://lore.kernel.org/all/[email protected]/
Fixes: f5c7310 ("init/main: add checks for the return value of memblock_alloc*()")
Cc: [email protected]
Signed-off-by: Yuntao Wang <[email protected]>
Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Portia Stephens <[email protected]>
Signed-off-by: Stefan Bader <[email protected]>1 parent 9b80427 commit e9a24eb
1 file changed
+2
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
640 | 640 | | |
641 | 641 | | |
642 | 642 | | |
| 643 | + | |
| 644 | + | |
643 | 645 | | |
644 | 646 | | |
645 | 647 | | |
| |||
0 commit comments