@@ -959,3 +959,31 @@ def test_dns_compression_loop_attack():
959959 )
960960 parsed = r .DNSIncoming (packet )
961961 assert len (parsed .answers ) == 0
962+
963+
964+ def test_txt_after_invalid_nsec_name_still_usable ():
965+ """Test that we can see the txt record after the invalid nsec record."""
966+ packet = (
967+ b'\x00 \x00 \x84 \x00 \x00 \x00 \x00 \x06 \x00 \x00 \x00 \x00 \x06 _sonos\x04 _tcp\x05 loc'
968+ b'al\x00 \x00 \x0c \x00 \x01 \x00 \x00 \x11 \x94 \x00 \x15 \x12 Sonos-542A1BC9220E'
969+ b'\xc0 \x0c \x12 Sonos-542A1BC9220E\xc0 \x18 \x00 /\x80 \x01 \x00 \x00 \x00 x\x00 '
970+ b'\x08 \xc1 t\x00 \x04 @\x00 \x00 \x08 \xc0 )\x00 /\x80 \x01 \x00 \x00 \x11 \x94 \x00 '
971+ b'\t \xc0 )\x00 \x05 \x00 \x00 \x80 \x00 @\xc0 )\x00 !\x80 \x01 \x00 \x00 \x00 x'
972+ b'\x00 \x08 \x00 \x00 \x00 \x00 \x05 \xa3 \xc0 >\xc0 >\x00 \x01 \x80 \x01 \x00 \x00 \x00 x'
973+ b'\x00 \x04 \xc0 \xa8 \x02 :\xc0 )\x00 \x10 \x80 \x01 \x00 \x00 \x11 \x94 \x01 *2info=/api'
974+ b'/v1/players/RINCON_542A1BC9220E01400/info\x06 vers=3\x10 protovers=1.24.1\n bo'
975+ b'otseq=11%hhid=Sonos_rYn9K9DLXJe0f3LP9747lbvFvh;mhhid=Sonos_rYn9K9DLXJe0f3LP9'
976+ b'747lbvFvh.Q45RuMaeC07rfXh7OJGm<location=http://192.168.2.58:1400/xml/device_'
977+ b'description.xml\x0c sslport=1443\x0e hhsslport=1843\t variant=2\x0e mdnssequen'
978+ b'ce=0'
979+ )
980+ parsed = r .DNSIncoming (packet )
981+ # The NSEC record with the invalid name compression should be skipped
982+ assert parsed .answers [4 ].text == (
983+ b'2info=/api/v1/players/RINCON_542A1BC9220E01400/info\x06 vers=3\x10 protovers'
984+ b'=1.24.1\n bootseq=11%hhid=Sonos_rYn9K9DLXJe0f3LP9747lbvFvh;mhhid=Sonos_rYn'
985+ b'9K9DLXJe0f3LP9747lbvFvh.Q45RuMaeC07rfXh7OJGm<location=http://192.168.2.58:14'
986+ b'00/xml/device_description.xml\x0c sslport=1443\x0e hhsslport=1843\t varian'
987+ b't=2\x0e mdnssequence=0'
988+ )
989+ assert len (parsed .answers ) == 5
0 commit comments