From: Alan T. DeKok Date: Mon, 16 Sep 2019 23:36:05 +0000 (-0400) Subject: check max stack only if we're loading the file X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f4238df3c00f53a1a7f0e41010d971fa9c8e5b4a;p=thirdparty%2Ffreeradius-server.git check max stack only if we're loading the file --- diff --git a/src/lib/server/cf_file.c b/src/lib/server/cf_file.c index fcc12dd9f5c..a3b6044f728 100644 --- a/src/lib/server/cf_file.c +++ b/src/lib/server/cf_file.c @@ -835,11 +835,6 @@ static int process_include(cf_stack_t *stack, CONF_SECTION *parent, char const * value = ptr; while (*ptr && !isspace((int) *ptr)) ptr++; - if ((stack->depth + 1) >= MAX_STACK) { - ERROR("%s[%d]: Directories too deep", frame->filename, frame->lineno); - return -1; - } - /* * We're OK with whitespace after the filename. */ @@ -884,6 +879,11 @@ static int process_include(cf_stack_t *stack, CONF_SECTION *parent, char const * } } + if ((stack->depth + 1) >= MAX_STACK) { + ERROR("%s[%d]: Directories too deep", frame->filename, frame->lineno); + return -1; + } + /* * The filename doesn't end in '/', so it must be a file. */