From: Todd C. Miller Date: Thu, 31 Jan 2013 16:12:53 +0000 (-0500) Subject: Fix potential stack overflow due to infinite recursion in alias X-Git-Tag: SUDO_1_7_10p5~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9e712691b5f39d64665a8961640e2932e84a546d;p=sudo Fix potential stack overflow due to infinite recursion in alias cycle detection. From Daniel Kopecek. --HG-- branch : 1.7 --- diff --git a/visudo.c b/visudo.c index c000046c9..62ed9880e 100644 --- a/visudo.c +++ b/visudo.c @@ -1040,18 +1040,16 @@ alias_remove_recursive(name, type) struct alias *a; int rval = TRUE; - 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); return rval; }