Blame SOURCES/0040-Ticket-49470-overflow-in-pblock_get.patch

96373c
From 30fa0e4c993d4a91a90327329b50f02e637fe049 Mon Sep 17 00:00:00 2001
96373c
From: William Brown <firstyear@redhat.com>
96373c
Date: Tue, 28 Nov 2017 15:31:25 +0100
96373c
Subject: [PATCH] Ticket 49470 - overflow in pblock_get
96373c
96373c
Bug Description:  While getting the connection id we used an int
96373c
not a uint64_t
96373c
96373c
Fix Description:  Make the stack size uint64_t instead.
96373c
96373c
https://pagure.io/389-ds-base/issue/49470
96373c
96373c
Author: wibrown
96373c
96373c
Review by: tbordaz
96373c
---
96373c
 ldap/servers/slapd/modify.c | 5 +++--
96373c
 ldap/servers/slapd/pblock.c | 4 ++--
96373c
 ldap/servers/slapd/slap.h   | 2 +-
96373c
 3 files changed, 6 insertions(+), 5 deletions(-)
96373c
96373c
diff --git a/ldap/servers/slapd/modify.c b/ldap/servers/slapd/modify.c
96373c
index 6309975ae..0dcac646b 100644
96373c
--- a/ldap/servers/slapd/modify.c
96373c
+++ b/ldap/servers/slapd/modify.c
96373c
@@ -281,11 +281,12 @@ do_modify(Slapi_PBlock *pb)
96373c
 
96373c
     if (ignored_some_mods && (0 == smods.num_elements)) {
96373c
         if (pb_conn->c_isreplication_session) {
96373c
-            int connid, opid;
96373c
+            uint64_t connid;
96373c
+            int32_t opid;
96373c
             slapi_pblock_get(pb, SLAPI_CONN_ID, &connid);
96373c
             slapi_pblock_get(pb, SLAPI_OPERATION_ID, &opid);
96373c
             slapi_log_err(SLAPI_LOG_ERR, "do_modify",
96373c
-                          "Rejecting replicated password policy operation(conn=%d op=%d) for "
96373c
+                          "Rejecting replicated password policy operation(conn=%"PRIu64" op=%d) for "
96373c
                           "entry %s.  To allow these changes to be accepted, set passwordIsGlobalPolicy to 'on' in "
96373c
                           "cn=config.\n",
96373c
                           connid, opid, rawdn);
96373c
diff --git a/ldap/servers/slapd/pblock.c b/ldap/servers/slapd/pblock.c
96373c
index 8f87de5b5..4514c3ce6 100644
96373c
--- a/ldap/servers/slapd/pblock.c
96373c
+++ b/ldap/servers/slapd/pblock.c
96373c
@@ -412,7 +412,7 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
96373c
                           "slapi_pblock_get", "Connection is NULL and hence cannot access SLAPI_CONN_ID \n");
96373c
             return (-1);
96373c
         }
96373c
-        (*(PRUint64 *)value) = pblock->pb_conn->c_connid;
96373c
+        (*(uint64_t *)value) = pblock->pb_conn->c_connid;
96373c
         break;
96373c
     case SLAPI_CONN_DN:
96373c
         /*
96373c
@@ -2538,7 +2538,7 @@ slapi_pblock_set(Slapi_PBlock *pblock, int arg, void *value)
96373c
                           "slapi_pblock_set", "Connection is NULL and hence cannot access SLAPI_CONN_ID \n");
96373c
             return (-1);
96373c
         }
96373c
-        pblock->pb_conn->c_connid = *((PRUint64 *)value);
96373c
+        pblock->pb_conn->c_connid = *((uint64_t *)value);
96373c
         break;
96373c
     case SLAPI_CONN_DN:
96373c
         /*
96373c
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
96373c
index 44632580a..830944f72 100644
96373c
--- a/ldap/servers/slapd/slap.h
96373c
+++ b/ldap/servers/slapd/slap.h
96373c
@@ -1604,7 +1604,7 @@ typedef struct conn
96373c
     int c_gettingber;                /* in the middle of ber_get_next  */
96373c
     BerElement *c_currentber;        /* ber we're getting              */
96373c
     time_t c_starttime;              /* when the connection was opened */
96373c
-    PRUint64 c_connid;               /* id of this connection for stats*/
96373c
+    uint64_t c_connid;               /* id of this connection for stats*/
96373c
     PRUint64 c_maxthreadscount;      /* # of times a conn hit max threads */
96373c
     PRUint64 c_maxthreadsblocked;    /* # of operations blocked by maxthreads */
96373c
     int c_opsinitiated;              /* # ops initiated/next op id      */
96373c
-- 
96373c
2.13.6
96373c