summaryrefslogtreecommitdiff
path: root/source4/dsdb
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2013-02-25 15:48:20 +0100
committerDavid Disseldorp <ddiss@suse.de>2013-03-05 23:30:08 +0100
commit17424588c5d7b7dd1cda5eb6ca0d7d13524b963a (patch)
tree29777cc0d40f6bd8777e0fa29931ba547f208ebf /source4/dsdb
parentceb1d8b84a6bd7084447e4cc75bd6821d6fdbe34 (diff)
downloadsamba-17424588c5d7b7dd1cda5eb6ca0d7d13524b963a.tar.gz
samba-17424588c5d7b7dd1cda5eb6ca0d7d13524b963a.tar.bz2
samba-17424588c5d7b7dd1cda5eb6ca0d7d13524b963a.zip
dsdb: Check for pointers before we deference them.
Reviewed-by: David Disseldorp <ddiss@samba.org>
Diffstat (limited to 'source4/dsdb')
-rw-r--r--source4/dsdb/common/dsdb_dn.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/source4/dsdb/common/dsdb_dn.c b/source4/dsdb/common/dsdb_dn.c
index b53de409fe..0029f5d49e 100644
--- a/source4/dsdb/common/dsdb_dn.c
+++ b/source4/dsdb/common/dsdb_dn.c
@@ -87,6 +87,11 @@ struct dsdb_dn *dsdb_dn_parse(TALLOC_CTX *mem_ctx, struct ldb_context *ldb,
char *dn_str;
enum dsdb_dn_format dn_format = dsdb_dn_oid_to_format(dn_oid);
+
+ if (dn_blob == NULL || dn_blob->data == NULL || dn_blob->length == 0) {
+ return NULL;
+ }
+
switch (dn_format) {
case DSDB_INVALID_DN:
return NULL;
@@ -113,16 +118,11 @@ struct dsdb_dn *dsdb_dn_parse(TALLOC_CTX *mem_ctx, struct ldb_context *ldb,
return NULL;
}
- if (dn_blob && dn_blob->data
- && (strlen((const char*)dn_blob->data) != dn_blob->length)) {
+ if (strlen((const char*)dn_blob->data) != dn_blob->length) {
/* The RDN must not contain a character with value 0x0 */
return NULL;
}
-
- if (!dn_blob->data || dn_blob->length == 0) {
- return NULL;
- }
-
+
tmp_ctx = talloc_new(mem_ctx);
if (tmp_ctx == NULL) {
return NULL;