]> git.sur5r.net Git - openldap/commitdiff
ITS#8655 fix double free on paged search with pagesize 0
authorRyan Tandy <ryan@nardis.ca>
Thu, 18 May 2017 03:07:39 +0000 (20:07 -0700)
committerQuanah Gibson-Mount <quanah@openldap.org>
Mon, 22 May 2017 17:30:06 +0000 (10:30 -0700)
Fixes a double free when a search includes the Paged Results control
with a page size of 0 and the search base matches the filter.

servers/slapd/back-mdb/search.c

index 009939d5cdb7893c9a19f2daf61d717ef0224d02..d0db9183370e4aed940cec31203cb1f6de480ec7 100644 (file)
@@ -1066,7 +1066,8 @@ notfound:
                        /* check size limit */
                        if ( get_pagedresults(op) > SLAP_CONTROL_IGNORED ) {
                                if ( rs->sr_nentries >= ((PagedResultsState *)op->o_pagedresults_state)->ps_size ) {
-                                       mdb_entry_return( op, e );
+                                       if (e != base)
+                                               mdb_entry_return( op, e );
                                        e = NULL;
                                        send_paged_response( op, rs, &lastid, tentries );
                                        goto done;