ldb: avoid NULL deref in ldb_dn_from_ldb_val (CID 1034730)
[samba.git] / lib / ldb / common / ldb_dn.c
index a2122a8a80ae883847f3af17e75696a53cee5191..2e98f3914673bf2b605f50f19bdcd0196efd2812 100644 (file)
@@ -92,9 +92,10 @@ struct ldb_dn *ldb_dn_from_ldb_val(TALLOC_CTX *mem_ctx,
 {
        struct ldb_dn *dn;
 
-       if (! ldb) return NULL;
-
-       if (strdn && strdn->data
+       if (ldb == NULL || strdn == NULL) {
+               return NULL;
+       }
+       if (strdn->data
            && (strnlen((const char*)strdn->data, strdn->length) != strdn->length)) {
                /* The RDN must not contain a character with value 0x0 */
                return NULL;