Fix potential stack overflow due to infinite recursion in alias
cycle detection. From Daniel Kopecek.
This commit is contained in:
@@ -1066,18 +1066,16 @@ alias_remove_recursive(char *name, int type)
|
|||||||
bool rval = true;
|
bool rval = true;
|
||||||
debug_decl(alias_remove_recursive, SUDO_DEBUG_ALIAS)
|
debug_decl(alias_remove_recursive, SUDO_DEBUG_ALIAS)
|
||||||
|
|
||||||
if ((a = alias_find(name, type)) != NULL) {
|
if ((a = alias_remove(name, type)) != NULL) {
|
||||||
tq_foreach_fwd(&a->members, m) {
|
tq_foreach_fwd(&a->members, m) {
|
||||||
if (m->type == ALIAS) {
|
if (m->type == ALIAS) {
|
||||||
if (!alias_remove_recursive(m->name, type))
|
if (!alias_remove_recursive(m->name, type))
|
||||||
rval = false;
|
rval = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
rbinsert(alias_freelist, a);
|
||||||
}
|
}
|
||||||
alias_seqno++;
|
alias_seqno++;
|
||||||
a = alias_remove(name, type);
|
|
||||||
if (a)
|
|
||||||
rbinsert(alias_freelist, a);
|
|
||||||
debug_return_bool(rval);
|
debug_return_bool(rval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user