From 6fe6ccb048f1ba665f4e3ad5cd7de612504cf41a Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Wed, 23 Jan 2013 07:52:09 -0500 Subject: [PATCH] Fix potential stack overflow due to infinite recursion in alias cycle detection. From Daniel Kopecek. --- plugins/sudoers/visudo.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/sudoers/visudo.c b/plugins/sudoers/visudo.c index 34abec88f..2225aff0c 100644 --- a/plugins/sudoers/visudo.c +++ b/plugins/sudoers/visudo.c @@ -1066,18 +1066,16 @@ alias_remove_recursive(char *name, int type) bool rval = true; 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) { if (m->type == ALIAS) { if (!alias_remove_recursive(m->name, type)) rval = false; } } + rbinsert(alias_freelist, a); } alias_seqno++; - a = alias_remove(name, type); - if (a) - rbinsert(alias_freelist, a); debug_return_bool(rval); } -- 2.40.0