From 8032f5885d756d989af60d2b606088c9c0b07a13 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Wed, 17 Nov 1999 22:43:07 +0000 Subject: [PATCH] ITS#357: at_cn == NULL causes crash --- servers/slapd/back-bdb2/index.c | 7 +++++++ servers/slapd/back-ldbm/index.c | 11 +++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/servers/slapd/back-bdb2/index.c b/servers/slapd/back-bdb2/index.c index 6ef1ca2f73..4c078b5790 100644 --- a/servers/slapd/back-bdb2/index.c +++ b/servers/slapd/back-bdb2/index.c @@ -124,6 +124,13 @@ bdb2i_index_read( attr_normalize( type ); at_cn = at_canonical_name(type); + if ( at_cn == NULL ) { + Debug( LDAP_DEBUG_ANY, + "<= bdb2i_index_read no canonical name for type \"%s\"\n", + type != NULL ? type : "(NULL)", 0, 0 ); + return( NULL ); + } + if ( (db = bdb2i_cache_open( be, at_cn, BDB2_SUFFIX, LDBM_WRCREAT )) == NULL ) { Debug( LDAP_DEBUG_ANY, diff --git a/servers/slapd/back-ldbm/index.c b/servers/slapd/back-ldbm/index.c index 12db542582..d3b0795304 100644 --- a/servers/slapd/back-ldbm/index.c +++ b/servers/slapd/back-ldbm/index.c @@ -148,11 +148,18 @@ index_read( attr_normalize( type ); at_cn = at_canonical_name( type ); + if ( at_cn == NULL ) { + Debug( LDAP_DEBUG_ANY, + "<= index_read no canonical name for type \"%s\"\n", + type != NULL ? type : "(NULL)", 0, 0 ); + return( NULL ); + } + if ( (db = ldbm_cache_open( be, at_cn, LDBM_SUFFIX, LDBM_WRCREAT )) == NULL ) { Debug( LDAP_DEBUG_ANY, - "<= index_read NULL (could not open %s%s)\n", at_cn, - LDBM_SUFFIX, 0 ); + "<= index_read NULL (could not open %s%s)\n", + at_cn, LDBM_SUFFIX, 0 ); return( NULL ); } -- 2.39.5