libcli/ldap: ldap_full_packet() requires at least 6 bytes
authorStefan Metzmacher <metze@samba.org>
Mon, 4 Oct 2010 08:35:32 +0000 (10:35 +0200)
committerStefan Metzmacher <metze@samba.org>
Mon, 4 Oct 2010 14:05:15 +0000 (14:05 +0000)
metze

libcli/ldap/ldap_message.c

index e5b94b8df122d839ace939fa2eb9542b9feb4b97..b9f9dff223a7fe2007a7981b03972e23c22dd3b9 100644 (file)
@@ -1611,5 +1611,12 @@ _PUBLIC_ NTSTATUS ldap_decode(struct asn1_data *data,
 */
 NTSTATUS ldap_full_packet(void *private_data, DATA_BLOB blob, size_t *packet_size)
 {
 */
 NTSTATUS ldap_full_packet(void *private_data, DATA_BLOB blob, size_t *packet_size)
 {
+       if (blob.length < 6) {
+               /*
+                * We need at least 6 bytes to workout the length
+                * of the pdu.
+                */
+               return STATUS_MORE_ENTRIES;
+       }
        return asn1_peek_full_tag(blob, ASN1_SEQUENCE(0), packet_size);
 }
        return asn1_peek_full_tag(blob, ASN1_SEQUENCE(0), packet_size);
 }