Skip to content

Commit

Permalink
Check the instance of ADDR_ENTRY[0]
Browse files Browse the repository at this point in the history
  • Loading branch information
guedou committed Oct 14, 2024
1 parent 6f0faf3 commit 865c598
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scapy/layers/netbios.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ class NBNSQueryResponse(Packet):
]

def mysummary(self):
if not self.ADDR_ENTRY:
if not self.ADDR_ENTRY or \
not isinstance(self.ADDR_ENTRY[0], NBNS_ADD_ENTRY):
return "NBNSQueryResponse"
return "NBNSQueryResponse '\\\\%s' is at %s" % (
self.RR_NAME.decode(errors="backslashreplace"),
Expand Down
6 changes: 6 additions & 0 deletions test/scapy/layers/netbios.uts
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,9 @@ assert pkt[NBNSWackResponse].RR_NAME == b'SARAH'
z = raw(TCP()/NBTSession())
assert z == b'\x00\x8b\x00\x8b\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\x00\x00\x00\x00\x00\x00\x00\x00'
assert NBTSession in TCP(z)

= OSS-Fuzz Findings

raw_packet = b'E\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x05\x00\x00\x00'
packet = NBNSQueryResponse(raw_packet)
assert packet.summary() == "NBNSQueryResponse / Raw"

0 comments on commit 865c598

Please sign in to comment.