mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Replace previous commit with a check disallowing ptr from running
off the end of the list variable. PR: 5345, 5610 Submitted by: nagao@cs.titech.ac.jp
This commit is contained in:
parent
ff86df5bb2
commit
f48bc66239
1 changed files with 7 additions and 14 deletions
|
|
@ -286,21 +286,14 @@ static int _listmatch(list, group, len)
|
|||
while(isspace(*ptr))
|
||||
ptr++;
|
||||
|
||||
if (strchr(list, ',') == NULL) {
|
||||
if (strncmp(ptr, group, glen) == 0) {
|
||||
while (ptr < list + len) {
|
||||
cptr = ptr;
|
||||
while(*ptr != ',' && *ptr != '\0' && !isspace(*ptr))
|
||||
ptr++;
|
||||
if (strncmp(cptr, group, glen) == 0 && glen == (ptr - cptr))
|
||||
return(1);
|
||||
}
|
||||
} else {
|
||||
while (ptr < list + len) {
|
||||
cptr = ptr;
|
||||
while(*ptr != ',' && !isspace(*ptr))
|
||||
ptr++;
|
||||
if (strncmp(cptr, group, glen) == 0 &&
|
||||
glen == (ptr - cptr))
|
||||
return(1);
|
||||
while(*ptr == ',' || isspace(*ptr))
|
||||
ptr++;
|
||||
}
|
||||
while(*ptr == ',' || isspace(*ptr))
|
||||
ptr++;
|
||||
}
|
||||
|
||||
return(0);
|
||||
|
|
|
|||
Loading…
Reference in a new issue