ldb-samba: Fix a possible NULL pointer dereference
authorAndreas Schneider <asn@samba.org>
Mon, 8 May 2017 09:44:34 +0000 (11:44 +0200)
committerVolker Lendecke <vl@samba.org>
Tue, 16 May 2017 14:45:43 +0000 (16:45 +0200)
CID: #1402566
CID: #1402567

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue May 16 16:45:43 CEST 2017 on sn-devel-144

lib/ldb-samba/ldb_ildap.c

index 541971f63def5b1537f0635e82240e7890d10e40..a4e96e4f138053ef718e55efc963f19970148172 100644 (file)
@@ -863,7 +863,9 @@ static int ildb_connect(struct ldb_context *ldb, const char *url,
        return LDB_SUCCESS;
 
 failed:
-       ldb_set_errstring(ldb, ldap_errstr(ildb->ldap, module, status));
+       if (ildb != NULL && ildb->ldap != NULL) {
+               ldb_set_errstring(ldb, ldap_errstr(ildb->ldap, module, status));
+       }
        talloc_free(module);
        if (NT_STATUS_IS_LDAP(status)) {
                return NT_STATUS_LDAP_CODE(status);