andykimpe / rpms / 389-ds-base

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

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

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