From: Alan T. DeKok Date: Tue, 27 Oct 2015 16:57:02 +0000 (-0400) Subject: More checks for else. Fixes #1355 X-Git-Tag: release_3_0_11~199 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf22a42321f31ed2ce3c717fe812beebee333dc6;p=thirdparty%2Ffreeradius-server.git More checks for else. Fixes #1355 --- diff --git a/src/main/modcall.c b/src/main/modcall.c index 253b1bb6aaf..cd46e24c170 100644 --- a/src/main/modcall.c +++ b/src/main/modcall.c @@ -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;