zipl: set NULL-termination for the new command line

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 <prudo@linux.ibm.com>
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Marc Hartmayer
2020-04-17 11:01:24 +02:00
committed by Jan Höppner
parent 0ac7ce964e
commit 0c583ec1a6

View File

@@ -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;