Bounds check first.

Found with: cppcheck
This commit is contained in:
Emil Mikulic 2018-08-22 01:14:17 +10:00
parent 41b68476c3
commit aad4574163
1 changed files with 2 additions and 2 deletions

View File

@ -1575,7 +1575,7 @@ static void parse_range_field(struct connection *conn) {
/* parse number up to hyphen */ /* parse number up to hyphen */
bound1 = 0; bound1 = 0;
for (bound2=0; for (bound2=0;
isdigit((int)range[bound2]) && (bound2 < len); (bound2 < len) && isdigit((int)range[bound2]);
bound2++) bound2++)
; ;
@ -1590,7 +1590,7 @@ static void parse_range_field(struct connection *conn) {
/* parse number after hyphen */ /* parse number after hyphen */
bound2++; bound2++;
for (bound1=bound2; for (bound1=bound2;
isdigit((int)range[bound2]) && (bound2 < len); (bound2 < len) && isdigit((int)range[bound2]);
bound2++) bound2++)
; ;