From: Howard Chu Date: Thu, 17 Apr 2003 04:55:39 +0000 (+0000) Subject: Fix database search loop conditions X-Git-Tag: OPENLDAP_REL_ENG_2_2_0ALPHA~332 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7dcb79157dc9fb049f57a7fbb902d9ce42f320da;p=openldap Fix database search loop conditions --- diff --git a/servers/slapd/back-bdb/dbcache.c b/servers/slapd/back-bdb/dbcache.c index 6d4456bde6..3eddc2ab1a 100644 --- a/servers/slapd/back-bdb/dbcache.c +++ b/servers/slapd/back-bdb/dbcache.c @@ -62,7 +62,7 @@ bdb_db_cache( *dbout = NULL; - for( i=BDB_NDB; bdb->bi_databases[i]; i++ ) { + for( i=BDB_NDB; i < BDB_INDICES && bdb->bi_databases[i]; i++ ) { if( !strcmp( bdb->bi_databases[i]->bdi_name, name) ) { *dbout = bdb->bi_databases[i]->bdi_db; return 0; @@ -86,7 +86,7 @@ bdb_db_cache( if (rc) return rc; /* check again! may have been added by another thread */ - for( i=BDB_NDB; bdb->bi_databases[i]; i++ ) { + for( i=BDB_NDB; i < BDB_INDICES && bdb->bi_databases[i]; i++ ) { if( !strcmp( bdb->bi_databases[i]->bdi_name, name) ) { *dbout = bdb->bi_databases[i]->bdi_db; LOCK_PUT( bdb->bi_dbenv, &lock); @@ -152,7 +152,6 @@ bdb_db_cache( return rc; } - bdb->bi_databases[i+1] = NULL; bdb->bi_databases[i] = db; bdb->bi_ndatabases = i+1;