]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
More checks for else. Fixes #1355
authorAlan T. DeKok <aland@freeradius.org>
Tue, 27 Oct 2015 16:57:02 +0000 (12:57 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 27 Oct 2015 16:57:56 +0000 (12:57 -0400)
src/main/modcall.c

index 253b1bb6aaf0ea665e82e110636d932f46bc1b9c..cd46e24c17062f768414c68f35e301b9c81bf017 100644 (file)
@@ -2823,7 +2823,7 @@ static modcallable *do_compile_modgroup(modcallable *parent,
                        rad_assert(parent != NULL);
                        p = mod_callabletogroup(parent);
 
-                       rad_assert(p->tail != NULL);
+                       if (!p->tail) goto elsif_fail;
 
                        /*
                         *      We're in the process of compiling the
@@ -2833,6 +2833,7 @@ static modcallable *do_compile_modgroup(modcallable *parent,
                        f = mod_callabletogroup(p->tail);
                        if ((f->mc.type != MOD_IF) &&
                            (f->mc.type != MOD_ELSIF)) {
+                       elsif_fail:
                                cf_log_err_cs(g->cs, "Invalid location for 'elsif'.  There is no preceding 'if' statement");
                                talloc_free(g);
                                return NULL;
@@ -2863,11 +2864,12 @@ static modcallable *do_compile_modgroup(modcallable *parent,
                        rad_assert(parent != NULL);
                        p = mod_callabletogroup(parent);
 
-                       rad_assert(p->tail != NULL);
+                       if (!p->tail) goto else_fail;
 
                        f = mod_callabletogroup(p->tail);
                        if ((f->mc.type != MOD_IF) &&
                            (f->mc.type != MOD_ELSIF)) {
+                       else_fail:
                                cf_log_err_cs(g->cs, "Invalid location for 'else'.  There is no preceding 'if' statement");
                                talloc_free(g);
                                return NULL;