From: Alan T. DeKok Date: Fri, 1 Nov 2019 14:47:54 +0000 (-0400) Subject: error out of we can't find an appropriate parent X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f083b38febfed5edfbc0af268589de1bc9e17f1;p=thirdparty%2Ffreeradius-server.git error out of we can't find an appropriate parent --- diff --git a/src/lib/util/dict_tokenize.c b/src/lib/util/dict_tokenize.c index f3cf192f924..308a6b7dfed 100644 --- a/src/lib/util/dict_tokenize.c +++ b/src/lib/util/dict_tokenize.c @@ -978,16 +978,24 @@ static int dict_read_process_struct(dict_tokenize_ctx_t *ctx, char **argv, int a * enclosing "struct": unwind until we do find the * parent, OR until we hit the root of the dictionary. */ - if (ctx->stack[ctx->stack_depth].da != parent->parent) { + if ((ctx->stack_depth > 1) && (ctx->stack[ctx->stack_depth].da != parent->parent)) { int i; + bool found = false; for (i = ctx->stack_depth - 1; i > 0; i--) { if ((ctx->stack[i].da == parent->parent) || (ctx->stack[i].da->flags.is_root)) { ctx->stack_depth = i; + found = true; break; } } + + if (!found) { + fr_strerror_printf("Invalid STRUCT definition, unknown key attribute %s", + parent->name); + return -1; + } } /*