]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
reset parent if ref'd TLV is inside of a group
authorAlan T. DeKok <aland@freeradius.org>
Thu, 5 Dec 2024 20:44:49 +0000 (15:44 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Sat, 7 Dec 2024 13:44:32 +0000 (08:44 -0500)
the decoder is still wrong, but at least we're not printing out
garbage

src/lib/util/pair_print.c
src/tests/unit/protocols/dhcpv6/group-tlv.txt

index 667ac1c28012f82b5218f371576907d332798f29..d475c1a2d43e710ebfa1f62c541f9068e8dcf8a1 100644 (file)
 
 /*
  *     Groups are printed from the referenced attribute.
+ *
+ *     @todo - parent should _never_ be vp->da.
  */
 #define fr_pair_reset_parent(parent) do { \
        if (parent && (parent->type == FR_TYPE_GROUP)) { \
                parent = fr_dict_attr_ref(parent); \
                if (parent->flags.is_root) parent = NULL; \
        } \
+       if (parent && (parent == vp->da)) parent = NULL; \
   } while (0)
 
 /** Pair serialisation API
index 861369ccd650751baeb88e1b600ecd576a9cdf64..31dce26dd5bbfe9cf9bcee8bd9a3a581001c740b 100644 (file)
@@ -13,7 +13,6 @@ fuzzer-out dhcpv6
 pair test-group = { child1 = 1 }
 match test-group = { child1 = 1 }
 
-
 encode-pair    test-group = { child1 = 1 }
 match 1a 9a 00 0c 1a 99 00 08 00 01 00 04 00 00 00 01
 
@@ -24,7 +23,7 @@ match 1a 9a 00 0c 1a 99 00 08 00 01 00 04 00 00 00 01
 #  @todo - fix it!
 #
 decode-pair -
-match test-group = {  = { child1 = 1 } }
+match test-group = { test-tlv = { child1 = 1 } }
 
 count
 match 10