From 9e712691b5f39d64665a8961640e2932e84a546d Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Thu, 31 Jan 2013 11:12:53 -0500 Subject: [PATCH] Fix potential stack overflow due to infinite recursion in alias cycle detection. From Daniel Kopecek. --HG-- branch : 1.7 --- visudo.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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; } -- 2.40.0