]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
don't allow registrations of one-letter overlaps with %Y etc.
authorAlan T. DeKok <aland@freeradius.org>
Wed, 27 Sep 2023 18:58:28 +0000 (14:58 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 27 Sep 2023 18:58:28 +0000 (14:58 -0400)
src/lib/unlang/xlat_func.c

index 182f630499573e2465e60bfb48ad1a144ec73b58..9c4960a8a76e2ead722d5f1f5bfd71f35f8e378b 100644 (file)
@@ -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);