From: Howard Chu Date: Sat, 20 Sep 2003 07:48:57 +0000 (+0000) Subject: Fix segfault if entry_get is called with NULL attribute X-Git-Tag: OPENLDAP_REL_ENG_2_1_MP~697 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=20902a2be3d9a814e063ede83147202c41e77204;p=openldap Fix segfault if entry_get is called with NULL attribute --- diff --git a/servers/slapd/back-bdb/id2entry.c b/servers/slapd/back-bdb/id2entry.c index c97feb2684..865e4da3d6 100644 --- a/servers/slapd/back-bdb/id2entry.c +++ b/servers/slapd/back-bdb/id2entry.c @@ -231,7 +231,7 @@ int bdb_entry_get( Entry *e = NULL; EntryInfo *ei; int rc; - const char *at_name = at->ad_cname.bv_val; + const char *at_name = at ? at->ad_cname.bv_val : "(null)"; u_int32_t locker = 0; DB_LOCK lock; diff --git a/servers/slapd/back-ldap/search.c b/servers/slapd/back-ldap/search.c index 0784c1ed51..b00cd663d6 100644 --- a/servers/slapd/back-ldap/search.c +++ b/servers/slapd/back-ldap/search.c @@ -605,10 +605,12 @@ ldap_back_entry_get( return 1; } - ldap_back_map(&li->rwmap.rwm_at, &at->ad_cname, &mapped, BACKLDAP_MAP); - if (mapped.bv_val == NULL || mapped.bv_val[0] == '\0') { - rc = 1; - goto cleanup; + if ( at ) { + ldap_back_map(&li->rwmap.rwm_at, &at->ad_cname, &mapped, BACKLDAP_MAP); + if (mapped.bv_val == NULL || mapped.bv_val[0] == '\0') { + rc = 1; + goto cleanup; + } } is_oc = (strcasecmp("objectclass", mapped.bv_val) == 0); diff --git a/servers/slapd/back-ldbm/entry.c b/servers/slapd/back-ldbm/entry.c index 33edb9bfc3..a3f15e7771 100644 --- a/servers/slapd/back-ldbm/entry.c +++ b/servers/slapd/back-ldbm/entry.c @@ -62,7 +62,7 @@ int ldbm_back_entry_get( struct ldbminfo *li = (struct ldbminfo *) op->o_bd->be_private; Entry *e; int rc; - const char *at_name = at->ad_cname.bv_val; + const char *at_name = at ? at->ad_cname.bv_val : "(null)"; #ifdef NEW_LOGGING LDAP_LOG( BACK_LDBM, ARGS,