Skip to content

Commit bbb7bac

Browse files
Colin Ian Kingmartinkpetersen
authored andcommitted
snic: correctly check for array overrun on overly long version number
The snic version number is expected to be 4 decimals in the form like a netmask string with each number stored in an element in array v. However, there is an off-by-one check on the number of elements in v allowing one to pass a 5 decimal version number causing v[4] to be referenced, causing a buffer overrun. Fix the off-by-one error by comparing to i > 3 rather than 4. Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Shane Seymour <shane.seymour@hpe.com> Reviewed-by: Ewan Milne <emilne@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent a6d2414 commit bbb7bac

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/scsi/snic/snic_ctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ snic_ver_enc(const char *s)
7575
continue;
7676
}
7777

78-
if (i > 4 || !isdigit(c))
78+
if (i > 3 || !isdigit(c))
7979
goto end;
8080

8181
v[i] = v[i] * 10 + (c - '0');

0 commit comments

Comments
 (0)