From dfbb7cce9eb334d0e15c2717bd74694338ac30a6 Mon Sep 17 00:00:00 2001 From: gpotter2 <10530980+gpotter2@users.noreply.github.com> Date: Mon, 14 Oct 2024 21:24:12 +0200 Subject: [PATCH] Fix LDAP test crash --- scapy/layers/ldap.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scapy/layers/ldap.py b/scapy/layers/ldap.py index fb29c5493d5..803dc8165f8 100644 --- a/scapy/layers/ldap.py +++ b/scapy/layers/ldap.py @@ -963,7 +963,14 @@ def tcp_reassemble(cls, data, *args, **kwargs): if length and len(x) >= length: remaining = x[length:] if not remaining: - return cls(data) + pkt = cls(data) + # Packet can be a whole response yet still miss some content. + if ( + LDAP_SearchResponseEntry in pkt and + LDAP_SearchResponseResultDone not in pkt + ): + return None + return pkt else: return None return None