andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone

Blame SOURCES/0071-Ticket-48192-Individual-abandoned-simple-paged-resul.patch

df9752
From aa6561d02969ce1db1a50da2b8af8679f6aeca69 Mon Sep 17 00:00:00 2001
df9752
From: Noriko Hosoi <nhosoi@redhat.com>
df9752
Date: Fri, 5 Jun 2015 10:13:17 -0700
df9752
Subject: [PATCH 71/72] Ticket #48192 - Individual abandoned simple paged
df9752
 results request has no chance to be cleaned up
df9752
df9752
Description: Checking the cookie value passed by the client was not
df9752
sufficient.  The negative value check was missing, which lead to
df9752
the simple paged results array out of bounds.  Plus, a minor memory
df9752
leak was fixed.  Thanks to Thierry Bordaz for his reviews!
df9752
df9752
https://fedorahosted.org/389/ticket/48192
df9752
(cherry picked from commit 298371d372678cf553594ae73ae57a6ea35358bf)
df9752
(cherry picked from commit 7718eb6a6714d1a284c3c706e621a7eb0ca5655a)
df9752
---
df9752
 ldap/servers/slapd/pagedresults.c | 4 ++--
df9752
 1 file changed, 2 insertions(+), 2 deletions(-)
df9752
df9752
diff --git a/ldap/servers/slapd/pagedresults.c b/ldap/servers/slapd/pagedresults.c
df9752
index 402dd10..2e70e19 100644
df9752
--- a/ldap/servers/slapd/pagedresults.c
df9752
+++ b/ldap/servers/slapd/pagedresults.c
df9752
@@ -177,14 +177,14 @@ pagedresults_parse_control_value( Slapi_PBlock *pb,
df9752
         memcpy(ptr, cookie.bv_val, cookie.bv_len);
df9752
         *(ptr+cookie.bv_len) = '\0';
df9752
         *index = strtol(ptr, NULL, 10);
df9752
-        if (conn->c_pagedresults.prl_maxlen <= *index) {
df9752
+        slapi_ch_free_string(&ptr);
df9752
+        if ((conn->c_pagedresults.prl_maxlen <= *index) || (*index < 0)){
df9752
             rc = LDAP_PROTOCOL_ERROR;
df9752
             LDAPDebug1Arg(LDAP_DEBUG_ANY,
df9752
                           "pagedresults_parse_control_value: invalid cookie: %d\n",
df9752
                           *index);
df9752
             goto bail;
df9752
         }
df9752
-        slapi_ch_free_string(&ptr);
df9752
         prp = conn->c_pagedresults.prl_list + *index;
df9752
         if (!(prp->pr_search_result_set)) { /* freed and reused for the next backend. */
df9752
             conn->c_pagedresults.prl_count++;
df9752
-- 
df9752
1.9.3
df9752