]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
If call_env custom parser returns nothing, skip the current pair
authorNick Porter <nick@portercomputing.co.uk>
Wed, 28 Feb 2024 10:35:29 +0000 (10:35 +0000)
committerNick Porter <nick@portercomputing.co.uk>
Tue, 5 Mar 2024 20:43:17 +0000 (20:43 +0000)
src/lib/unlang/call_env.c

index c93658e89e21d036a1868210a11950b63c908d3e..b9981a949859a58456c028c10a5702f930433994 100644 (file)
@@ -470,6 +470,10 @@ static int call_env_parse(TALLOC_CTX *ctx, call_env_parsed_head_t *parsed, char
                                        talloc_free(tmp_cp);
                                        return -1;
                                }
+                               if (!call_env_parsed->data.ptr) {
+                                       talloc_free(call_env_parsed);
+                                       goto next_pair;
+                               }
                        } else {
                                tmpl_t *parsed_tmpl;
 
@@ -486,8 +490,9 @@ static int call_env_parse(TALLOC_CTX *ctx, call_env_parsed_head_t *parsed, char
                         */
                        if (call_env_parsed_valid(call_env_parsed, cf_pair_to_item(to_parse), rule) < 0) goto error;
 
-                       talloc_free(tmp_cp);
                        call_env_parsed_insert_tail(parsed, call_env_parsed);
+               next_pair:
+                       talloc_free(tmp_cp);
                        cp = cf_pair_find_next(cs, cp, rule->name);
                }
        next: