Skip to content

Commit 706568b

Browse files
guedougpotter2
andauthored
Check the instance of ADDR_ENTRY[0] (#4565)
* Check the instance of ADDR_ENTRY[0] * Update test/scapy/layers/netbios.uts Co-authored-by: gpotter2 <10530980+gpotter2@users.noreply.github.com> --------- Co-authored-by: gpotter2 <10530980+gpotter2@users.noreply.github.com>
1 parent ce81649 commit 706568b

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

scapy/layers/netbios.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ class NBNSQueryResponse(Packet):
185185
]
186186

187187
def mysummary(self):
188-
if not self.ADDR_ENTRY:
188+
if not self.ADDR_ENTRY or \
189+
not isinstance(self.ADDR_ENTRY[0], NBNS_ADD_ENTRY):
189190
return "NBNSQueryResponse"
190191
return "NBNSQueryResponse '\\\\%s' is at %s" % (
191192
self.RR_NAME.decode(errors="backslashreplace"),

test/scapy/layers/netbios.uts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,11 @@ assert pkt[NBNSWackResponse].RR_NAME == b'SARAH'
9999
z = raw(TCP()/NBTSession())
100100
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'
101101
assert NBTSession in TCP(z)
102+
103+
= OSS-Fuzz Findings
104+
105+
# Note: the packet is corrupted
106+
with no_debug_dissector():
107+
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'
108+
packet = NBNSQueryResponse(raw_packet)
109+
assert packet.summary() == "NBNSQueryResponse"

0 commit comments

Comments
 (0)