From: Alan T. DeKok Date: Sat, 8 Jul 2023 19:44:06 +0000 (-0400) Subject: add simple test for TLV nesting X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6a436f01f485b1b9a2f0e7666014e8f913fc0917;p=thirdparty%2Ffreeradius-server.git add simple test for TLV nesting just in case new code generates the wrong thing --- diff --git a/src/lib/util/pair.c b/src/lib/util/pair.c index a3ff2b00089..632a53a65af 100644 --- a/src/lib/util/pair.c +++ b/src/lib/util/pair.c @@ -2899,6 +2899,13 @@ void fr_pair_verify(char const *file, int line, fr_pair_list_t const *list, fr_p */ if (!fr_type_is_structural(vp->vp_type)) { if (vp->data.enumv) fr_dict_attr_verify(file, line, vp->data.enumv); + } else { + fr_pair_t *parent = fr_pair_parent(vp); + + if (parent && (parent->vp_type != FR_TYPE_GROUP) && (parent->da == vp->da)) { + fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: fr_pair_t \"%s\" structural (non-group) type contains itself", + file, line, vp->da->name); + } } switch (vp->vp_type) {