]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
tweak checks for type size
authorAlan T. DeKok <aland@freeradius.org>
Mon, 24 Nov 2025 17:19:06 +0000 (12:19 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 24 Nov 2025 17:40:12 +0000 (12:40 -0500)
src/lib/util/dict_util.c

index 8dc1534f5e6c2c1797135dfac1d0147f5bc14fc8..58b1715762825be21097eeeb0614350c7860bf1d 100644 (file)
@@ -2337,13 +2337,13 @@ ssize_t fr_dict_attr_by_oid_legacy(fr_dict_t const *dict, fr_dict_attr_t const *
        }
 
        /*
-        *      If it's not a vendor type, it must be between 0..8*type_size
-        *
-        *      @fixme: find the TLV parent, and check it's size
+        *      TLVs must have a defined size.
         */
-       if (((*parent)->type != FR_TYPE_VENDOR) && ((*parent)->type != FR_TYPE_VSA) && !(*parent)->flags.is_root &&
-           (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)));
+       if (((*parent)->type == FR_TYPE_TLV) &&
+           (!(*parent)->flags.internal && !(*parent)->flags.name_only && !(*parent)->flags.is_root &&
+            (num > ((uint64_t) 1 << (8 * (*parent)->flags.type_size))))) {
+               fr_strerror_printf("TLV attributes of parent %s must be %" PRIu64 " bits or less",
+                                  (*parent)->name, ((uint64_t)1 << (8 * (*parent)->flags.type_size)));
                return 0;
        }