From: Howard Chu Date: Mon, 13 Apr 2015 20:11:29 +0000 (-0700) Subject: ITS#8103 fix crash with more than 65535 aliases in a scope X-Git-Tag: OPENLDAP_REL_ENG_2_5_0ALPHA~141^2~72 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15347d1180a8f813d8b4321f65aacd1967203793;p=thirdparty%2Fopenldap.git ITS#8103 fix crash with more than 65535 aliases in a scope --- diff --git a/servers/slapd/back-mdb/dn2id.c b/servers/slapd/back-mdb/dn2id.c index 45f95225e1..d1845f7109 100644 --- a/servers/slapd/back-mdb/dn2id.c +++ b/servers/slapd/back-mdb/dn2id.c @@ -664,6 +664,11 @@ mdb_idscope( ptr += data.mv_size - sizeof(ID); memcpy( &id, ptr, sizeof(ID) ); if ( id == base ) { + if ( res[0] >= MDB_IDL_DB_SIZE-1 ) { + /* too many aliases in scope. Fallback to range */ + MDB_IDL_RANGE( res, MDB_IDL_FIRST( ids ), MDB_IDL_LAST( ids )); + goto leave; + } res[0]++; res[res[0]] = ida; copy = 0; @@ -685,6 +690,7 @@ mdb_idscope( if (!MDB_IDL_IS_RANGE( ids )) ids[0] = idc; +leave: mdb_cursor_close( cursor ); return rc; }