summaryrefslogtreecommitdiff
path: root/libcli
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2015-06-15 15:49:07 -0700
committerJeremy Allison <jra@samba.org>2015-06-16 04:16:13 +0200
commit95fc7fbe8270894d41404499ac79d699be0fb75c (patch)
tree04af66174251e195655ffd891cf95c81bf06453e /libcli
parent28f51b915947061555ee12f8fbe0e5fab91f4194 (diff)
downloadsamba-95fc7fbe8270894d41404499ac79d699be0fb75c.tar.gz
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
Diffstat (limited to 'libcli')
-rw-r--r--libcli/ldap/ldap_message.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libcli/ldap/ldap_message.c b/libcli/ldap/ldap_message.c
index ba94f4ccfac..0c664b70101 100644
--- a/libcli/ldap/ldap_message.c
+++ b/libcli/ldap/ldap_message.c
@@ -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);