]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
TLVs can have STRUCTs for parents, too.
authorAlan T. DeKok <aland@freeradius.org>
Tue, 9 Dec 2025 18:50:01 +0000 (13:50 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 9 Dec 2025 18:51:42 +0000 (13:51 -0500)
and convert assertion to run-time check.  Because the fuzzers don't
produce helpful stack traces.

src/lib/util/decode.c

index ab6099a5e65e9184df1a4ae17e29d219b525e398..fdb3c5584e489bb3263baf4b1fa39de951829d97 100644 (file)
@@ -160,9 +160,17 @@ ssize_t fr_pair_tlvs_from_network(TALLOC_CTX *ctx, fr_pair_list_t *out,
 
        FR_PROTO_HEX_DUMP(data, data_len, "fr_pair_tlvs_from_network");
 
-       if (!fr_cond_assert_msg((parent->type == FR_TYPE_TLV || (parent->type == FR_TYPE_VENDOR)),
-                               "%s: Internal sanity check failed, attribute \"%s\" is not of type 'tlv'",
-                               __FUNCTION__, parent->name)) return PAIR_DECODE_FATAL_ERROR;
+       switch (parent->type) {
+       case FR_TYPE_TLV:
+       case FR_TYPE_VENDOR:
+       case FR_TYPE_STRUCT:
+               break;
+
+       default:
+               fr_strerror_printf("Internal sanity check failed, attribute \"%s\" has unexpected data type '%s'",
+                                  parent->name, fr_type_to_str(parent->type));
+               return PAIR_DECODE_FATAL_ERROR;
+       }
 
        /*
         *      Do a quick sanity check to see if the TLVs are at all OK.