zipl: check array limits before indexing

Resolves Cppcheck warning:
[zipl/boot/menu.c:126]: (style) Array index 'i' is used before limits check.

Cc: Stefan Haberland <stefan.haberland@de.ibm.com>
Cc: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Jens Remus
2017-09-05 22:37:40 +02:00
committed by Jan Höppner
parent 31b77e1646
commit a1db08160d

View File

@@ -3,7 +3,7 @@
*
* Bootmenu Subroutines
*
* Copyright IBM Corp. 2013, 2017
* Copyright IBM Corp. 2013, 2018
*
* s390-tools is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
@@ -123,7 +123,7 @@ static int menu_param(unsigned long *value)
/* no number, check for keyword */
i = 0;
/* skip leading whitespaces */
while (ebc_isspace(loadparm[i]) && (i < PARAM_SIZE))
while ((i < PARAM_SIZE) && ebc_isspace(loadparm[i]))
i++;
if (!strncmp(&loadparm[i], "PROMPT", 6)) {