From: Arran Cudbard-Bell Date: Tue, 26 Sep 2017 10:49:53 +0000 (+0800) Subject: Use cached enum value so we don't SEGV if type is "auth", "acct" etc.. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d8303d3c65b8592a71b15d4e2970eaaed1ffb727;p=thirdparty%2Ffreeradius-server.git Use cached enum value so we don't SEGV if type is "auth", "acct" etc.. --- diff --git a/src/modules/proto_radius/proto_radius.c b/src/modules/proto_radius/proto_radius.c index 9a2741d8635..bc9657a3e0d 100644 --- a/src/modules/proto_radius/proto_radius.c +++ b/src/modules/proto_radius/proto_radius.c @@ -111,6 +111,8 @@ static int type_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PAR } } + cf_data_add(ci, type_enum, NULL, false); + code = type_enum->value->vb_uint32; if (code >= FR_CODE_MAX) { invalid_type: @@ -369,7 +371,8 @@ static int mod_instantiate(void *instance, CONF_SECTION *conf) * Instantiate the process modules */ while ((cp = cf_pair_find_next(conf, cp, "type"))) { - fr_app_process_t const *app_process; + fr_app_process_t const *app_process; + fr_dict_enum_t const *enumv; int code; app_process = (fr_app_process_t const *)inst->type_submodule[i]->module->common; @@ -382,7 +385,10 @@ static int mod_instantiate(void *instance, CONF_SECTION *conf) /* * We've already done bounds checking in the process_parse function */ - code = fr_dict_enum_by_alias(NULL, da, cf_pair_value(cp))->value->vb_uint32; + enumv = cf_data_value(cf_data_find(cp, fr_dict_enum_t, NULL)); + if (!fr_cond_assert(enumv)) return -1; + + code = enumv->value->vb_uint32; inst->process_by_code[code] = app_process->process; /* Store the process function */ inst->code_allowed[code] = true; i++;