mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
fdasd: check array limits before indexing
Found using Cppcheck: [fdasd/fdasd.c:261]: (style) Array index 'from' is used before limits check. Cc: Stefan Haberland <sth@linux.ibm.com> Cc: Jan Hoeppner <hoeppner@linux.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:
@@ -258,7 +258,7 @@ static void fdasd_check_volser(char *volser, int devno)
|
||||
{
|
||||
int from, to;
|
||||
|
||||
for (from = 0, to = 0; volser[from] && from < VOLSER_LENGTH; from++)
|
||||
for (from = 0, to = 0; from < VOLSER_LENGTH && volser[from]; from++)
|
||||
if ((volser[from] >= 0x23 &&
|
||||
volser[from] <= 0x25) || /* # $ % */
|
||||
(volser[from] >= 0x30 &&
|
||||
|
||||
Reference in New Issue
Block a user