]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
move parse check to before extra work
authorAlan T. DeKok <aland@freeradius.org>
Mon, 26 Aug 2024 17:43:15 +0000 (13:43 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 27 Aug 2024 20:01:08 +0000 (16:01 -0400)
src/lib/server/cf_file.c

index 15c5c72ac224162145b17dc04c7772b85364c80c..a9efe1dce722330c249aa729563b2c4c605ecee4 100644 (file)
@@ -1631,6 +1631,16 @@ static CONF_ITEM *process_if(cf_stack_t *stack)
 
        fr_assert((size_t) slen < (stack->bufsize - 1));
 
+       ptr += slen;
+       fr_skip_whitespace(ptr);
+
+       if (*ptr != '{') {
+               cf_log_err(cs, "Expected '{' instead of %s", ptr);
+               talloc_free(cs);
+               return NULL;
+       }
+       ptr++;
+
        /*
         *      Save the parsed condition (minus trailing whitespace)
         *      into a buffer.
@@ -1657,16 +1667,6 @@ static CONF_ITEM *process_if(cf_stack_t *stack)
        MEM(cs->name2 = talloc_typed_strdup(cs, buff[3]));
        cs->name2_quote = T_BARE_WORD;
 
-       ptr += slen;
-       fr_skip_whitespace(ptr);
-
-       if (*ptr != '{') {
-               cf_log_err(cs, "Expected '{' instead of %s", ptr);
-               talloc_free(cs);
-               return NULL;
-       }
-       ptr++;
-
        stack->ptr = ptr;
 
        cs->allow_locals = true;