Blame SOURCES/openldap-ITS8655-fix-double-free-on-paged-search-with-pagesize-0.patch

adf540
commit ec2fe743f5795eb7aaf43687e6b257ac071cef22
adf540
Author: Ryan Tandy <ryan@nardis.ca>
adf540
Date:   Wed May 17 20:07:39 2017 -0700
adf540
adf540
    ITS#8655 fix double free on paged search with pagesize 0
adf540
    
adf540
    Fixes a double free when a search includes the Paged Results control
adf540
    with a page size of 0 and the search base matches the filter.
adf540
adf540
diff --git a/servers/slapd/back-mdb/search.c b/servers/slapd/back-mdb/search.c
adf540
index 009939d..d0db918 100644
adf540
--- a/servers/slapd/back-mdb/search.c
adf540
+++ b/servers/slapd/back-mdb/search.c
adf540
@@ -1066,7 +1066,8 @@ notfound:
adf540
 			/* check size limit */
adf540
 			if ( get_pagedresults(op) > SLAP_CONTROL_IGNORED ) {
adf540
 				if ( rs->sr_nentries >= ((PagedResultsState *)op->o_pagedresults_state)->ps_size ) {
adf540
-					mdb_entry_return( op, e );
adf540
+					if (e != base)
adf540
+						mdb_entry_return( op, e );
adf540
 					e = NULL;
adf540
 					send_paged_response( op, rs, &lastid, tentries );
adf540
 					goto done;