From: Alan T. DeKok Date: Tue, 9 Dec 2025 18:50:01 +0000 (-0500) Subject: TLVs can have STRUCTs for parents, too. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f9a2334e02e81047b58ba3cb996d84ff9b67bb2;p=thirdparty%2Ffreeradius-server.git TLVs can have STRUCTs for parents, too. and convert assertion to run-time check. Because the fuzzers don't produce helpful stack traces. --- diff --git a/src/lib/util/decode.c b/src/lib/util/decode.c index ab6099a5e65..fdb3c5584e4 100644 --- a/src/lib/util/decode.c +++ b/src/lib/util/decode.c @@ -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.