From 7dcb79157dc9fb049f57a7fbb902d9ce42f320da Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 17 Apr 2003 04:55:39 +0000 Subject: [PATCH] Fix database search loop conditions --- servers/slapd/back-bdb/dbcache.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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; -- 2.39.5