Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check the instance of ADDR_ENTRY[0] #4565

Merged
merged 2 commits into from
Dec 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
9 changes: 9 additions & 0 deletions test/scapy/layers/netbios.uts
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,12 @@ 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

# Note: the packet is corrupted
conf.debug_dissector = False
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"
conf.debug_dissector = True
guedou marked this conversation as resolved.
Show resolved Hide resolved
Loading