From 0c583ec1a68e998f5ed775a97d7f046aad5df28a Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Fri, 17 Apr 2020 11:01:24 +0200 Subject: [PATCH] zipl: set NULL-termination for the new command line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Let's assume the original `command_line` is 'aaaaaaaaaaaaaaaaaa' and `cextra` is ' =blub'. With the old code this would result in the following new command line: 'blubaaaaaaaaaaaaa' instead of the expected result 'blub\0aaaaaaaaaaaa' Let's fix this by setting the NULL-termination for the new command line. While at it, use the `command_line` variable instead of casting an address. Reviewed-by: Philipp Rudo Reviewed-by: Stefan Haberland Signed-off-by: Marc Hartmayer Signed-off-by: Jan Höppner --- zipl/boot/stage3.c | 1 + 1 file changed, 1 insertion(+) diff --git a/zipl/boot/stage3.c b/zipl/boot/stage3.c index 250c50e8..bb490dc8 100644 --- a/zipl/boot/stage3.c +++ b/zipl/boot/stage3.c @@ -204,6 +204,7 @@ void start(void) cextra++; cextra_len--; memcpy(cmdline, cextra, cextra_len); + cmdline[cextra_len] = 0; } else if (cmdline_len + 1 <= COMMAND_LINE_SIZE - 1) { /* add blank */ cmdline[cmdline_len] = 0x20;