]> granicus.if.org Git - sudo/commitdiff
Fix potential stack overflow due to infinite recursion in alias
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 23 Jan 2013 12:52:09 +0000 (07:52 -0500)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 23 Jan 2013 12:52:09 +0000 (07:52 -0500)
cycle detection.  From Daniel Kopecek.

--HG--
branch : 1.8

plugins/sudoers/visudo.c

index 11617099d40958e286b1d7f629b798ee80e0bb20..1b55080ad0693574e8b5a13e7977ad61499a3ed0 100644 (file)
@@ -1075,18 +1075,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);
 }