return;
}
if (npending == 0) {
+ ldapsrv_terminate_connection(conn, "EOF from client");
return;
}
-
conn->partial.data = talloc_realloc_size(conn, conn->partial.data,
conn->partial.length + npending);
if (conn->partial.data == NULL) {
ret->operation = LDB_OP_NOT;
ret->u.not.child = ldap_decode_filter_tree(ret, data);
-
+ if (ret->u.not.child == NULL) {
+ goto failed;
+ }
if (!asn1_end_tag(data)) {
goto failed;
}
failed:
talloc_free(ret);
- DEBUG(0,("Failed to parse ASN.1 LDAP filter\n"));
return NULL;
}
if (len < 0 || data->ofs + len < data->ofs || data->ofs + len < len)
return False;
- if (data->ofs + len > data->length)
+ if (data->ofs + len > data->length) {
+ /* we need to mark the buffer as consumed, so the caller knows
+ this was an out of data error, and not a decode error */
+ data->ofs = data->length;
return False;
+ }
memcpy(p, data->data + data->ofs, len);
return True;
do {
asn1_read_uint8(data, &b);
v = (v<<7) | (b&0x7f);
- } while (!data->has_error && b & 0x80);
+ } while (!data->has_error && (b & 0x80));
tmp_oid = talloc_asprintf_append(tmp_oid, " %u", v);
}
uint8_t b;
*i = 0;
- while (asn1_tag_remaining(data)>0) {
+ while (!data->has_error && asn1_tag_remaining(data)>0) {
if (!asn1_read_uint8(data, &b)) return False;
*i = (*i << 8) + b;
}
*v = 0;
if (!asn1_start_tag(data, ASN1_ENUMERATED)) return False;
- while (asn1_tag_remaining(data)>0) {
+ while (!data->has_error && asn1_tag_remaining(data)>0) {
uint8_t b;
asn1_read_uint8(data, &b);
*v = (*v << 8) + b;