mrc0mmand / rpms / openldap

Forked from rpms/openldap 3 years ago
Clone

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

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