From: Alan T. DeKok Date: Thu, 5 Dec 2024 20:44:49 +0000 (-0500) Subject: reset parent if ref'd TLV is inside of a group X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d27751d43c32ee74217b40b76853fe46d4f1a4a0;p=thirdparty%2Ffreeradius-server.git reset parent if ref'd TLV is inside of a group the decoder is still wrong, but at least we're not printing out garbage --- diff --git a/src/lib/util/pair_print.c b/src/lib/util/pair_print.c index 667ac1c2801..d475c1a2d43 100644 --- a/src/lib/util/pair_print.c +++ b/src/lib/util/pair_print.c @@ -16,12 +16,15 @@ /* * 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 diff --git a/src/tests/unit/protocols/dhcpv6/group-tlv.txt b/src/tests/unit/protocols/dhcpv6/group-tlv.txt index 861369ccd65..31dce26dd5b 100644 --- a/src/tests/unit/protocols/dhcpv6/group-tlv.txt +++ b/src/tests/unit/protocols/dhcpv6/group-tlv.txt @@ -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