]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
check max stack only if we're loading the file
authorAlan T. DeKok <aland@freeradius.org>
Mon, 16 Sep 2019 23:36:05 +0000 (19:36 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 17 Sep 2019 13:10:34 +0000 (09:10 -0400)
src/lib/server/cf_file.c

index fcc12dd9f5ce2c7310c5a0015055df3f22876e3b..a3b6044f7284de3d7cba3fe081230a49e5ff85d9 100644 (file)
@@ -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.
         */