]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
add simple test for TLV nesting
authorAlan T. DeKok <aland@freeradius.org>
Sat, 8 Jul 2023 19:44:06 +0000 (15:44 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 10 Jul 2023 19:55:07 +0000 (15:55 -0400)
just in case new code generates the wrong thing

src/lib/util/pair.c

index a3ff2b000899da1801a24907c49804384df52744..632a53a65afb6d7496f0ba373f818ed913fd4083 100644 (file)
@@ -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) {