From: Alan T. DeKok Date: Wed, 27 Sep 2023 18:58:28 +0000 (-0400) Subject: don't allow registrations of one-letter overlaps with %Y etc. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00f3ab776819e28caa12b7c7ef57862bf1dccd76;p=thirdparty%2Ffreeradius-server.git don't allow registrations of one-letter overlaps with %Y etc. --- diff --git a/src/lib/unlang/xlat_func.c b/src/lib/unlang/xlat_func.c index 182f6304995..9c4960a8a76 100644 --- a/src/lib/unlang/xlat_func.c +++ b/src/lib/unlang/xlat_func.c @@ -206,6 +206,7 @@ xlat_t *xlat_func_register_module(TALLOC_CTX *ctx, module_inst_ctx_t const *mctx fr_assert(xlat_root); if (!*name) { + invalid_name: ERROR("%s: Invalid xlat name", __FUNCTION__); return NULL; } @@ -220,6 +221,8 @@ xlat_t *xlat_func_register_module(TALLOC_CTX *ctx, module_inst_ctx_t const *mctx } len = strlen(name); + if ((len == 1) && (strchr("InscCdDeGHlmMStTY", *name) != NULL)) goto invalid_name; + in = FR_SBUFF_IN(name, len); fr_sbuff_adv_past_allowed(&in, SIZE_MAX, xlat_func_chars, NULL); used = fr_sbuff_used(&in);