mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-11 02:49:59 -04:00
fix possible NULL dereference in cfg_map_findclause()
`cfg_map_findclause()` did not check whether a clause existed before dereferencing it, which could lead to a NULL dereference. Add the missing check to prevent this. In practice, this was not triggering any known bug, since `cfg_map_findclause()` is only called in contexts where the clause is known to exist.
This commit is contained in:
parent
b0f7bb3495
commit
d1c55d78c6
1 changed files with 5 additions and 1 deletions
|
|
@ -2948,10 +2948,14 @@ cfg_map_findclause(const cfg_type_t *map, const char *name) {
|
|||
REQUIRE(name != NULL);
|
||||
|
||||
found = cfg_map_firstclause(map, &clauses, &idx);
|
||||
while (name != NULL && strcasecmp(name, found->name)) {
|
||||
while (found != NULL && name != NULL && strcasecmp(name, found->name)) {
|
||||
found = cfg_map_nextclause(map, &clauses, &idx);
|
||||
}
|
||||
|
||||
if (found == NULL) {
|
||||
return found;
|
||||
}
|
||||
|
||||
return ((cfg_clausedef_t *)clauses) + idx;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue