mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-04 23:19:00 +00: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
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=33950
@ -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 New Issue
Block a user