From 15347d1180a8f813d8b4321f65aacd1967203793 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 13 Apr 2015 13:11:29 -0700 Subject: [PATCH] ITS#8103 fix crash with more than 65535 aliases in a scope --- servers/slapd/back-mdb/dn2id.c | 6 ++++++ 1 file changed, 6 insertions(+) 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; } -- 2.39.5