1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

lib: ldap: Properly check talloc error returns.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jun 16 04:16:13 CEST 2015 on sn-devel-104
This commit is contained in:
Jeremy Allison 2015-06-15 15:49:07 -07:00
parent 28f51b9159
commit 95fc7fbe82

View File

@ -706,6 +706,9 @@ static const char *blob2string_talloc(TALLOC_CTX *mem_ctx,
DATA_BLOB blob)
{
char *result = talloc_array(mem_ctx, char, blob.length+1);
if (result == NULL) {
return NULL;
}
memcpy(result, blob.data, blob.length);
result[blob.length] = '\0';
return result;
@ -720,7 +723,7 @@ bool asn1_read_OctetString_talloc(TALLOC_CTX *mem_ctx,
return false;
*result = blob2string_talloc(mem_ctx, string);
data_blob_free(&string);
return true;
return *result ? true : false;
}
static bool ldap_decode_response(TALLOC_CTX *mem_ctx,
@ -868,6 +871,9 @@ static struct ldb_parse_tree *ldap_decode_filter_tree(TALLOC_CTX *mem_ctx,
ret->operation = LDB_OP_SUBSTRING;
ret->u.substring.attr = talloc_strndup(ret, (char *)attr.data, attr.length);
if (ret->u.substring.attr == NULL) {
goto failed;
}
ret->u.substring.chunks = NULL;
ret->u.substring.start_with_wildcard = 1;
ret->u.substring.end_with_wildcard = 1;
@ -1073,6 +1079,9 @@ static struct ldb_parse_tree *ldap_decode_filter_tree(TALLOC_CTX *mem_ctx,
ret->u.extended.attr = talloc_steal(ret, attr);
} else {
ret->u.extended.attr = talloc_strdup(ret, "*");
if (ret->u.extended.attr == NULL) {
goto failed;
}
}
ret->u.extended.rule_id = talloc_steal(ret, oid);
ret->u.extended.value.data = (uint8_t *)talloc_steal(ret, value);