]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
correct type size check.
authorAlan T. DeKok <aland@freeradius.org>
Wed, 15 Jan 2025 16:13:12 +0000 (11:13 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 15 Jan 2025 16:13:12 +0000 (11:13 -0500)
not everything is RADIUS

src/lib/util/dict_util.c

index bedbe7c2db07b52933f2b48eb515e3fd680a6282..7187951b79f1c04670719e014fd149ee81b09b54 100644 (file)
@@ -2165,8 +2165,8 @@ ssize_t fr_dict_attr_by_oid_legacy(fr_dict_t const *dict, fr_dict_attr_t const *
         *      @fixme: find the TLV parent, and check it's size
         */
        if (((*parent)->type != FR_TYPE_VENDOR) && ((*parent)->type != FR_TYPE_VSA) && !(*parent)->flags.is_root &&
-           (num > UINT8_MAX)) {
-               fr_strerror_const("TLV attributes must be between 0..255 inclusive");
+           (num > ((uint64_t) 1 << (8 * (*parent)->flags.type_size)))) {
+               fr_strerror_printf("TLV attributes must be %" PRIu64 " bits or less", ((uint64_t)1 << (8 * (*parent)->flags.type_size)));
                return 0;
        }