amoralej / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 years ago
Clone
Blob Blame History Raw
From 8f908a1de1906a0b7451505d9640e2fd2f9fa7eb Mon Sep 17 00:00:00 2001
From: Mark Reynolds <mreynolds@redhat.com>
Date: Wed, 22 Mar 2017 10:18:13 -0400
Subject: [PATCH] Issue 49188 - retrocl can crash server at shutdown

Description:  We do not calloc enough elements when processing nsslapd-attribute
              from the retrocl plugin configuration.  This causes invalid memory
              to be freed at shutdown(via slapi_ch_array_free).

https://pagure.io/389-ds-base/issue/49188

Reviewed by: mreynolds(one line commit rule)
---
 ldap/servers/plugins/retrocl/retrocl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ldap/servers/plugins/retrocl/retrocl.c b/ldap/servers/plugins/retrocl/retrocl.c
index 32b30c7..6e68667 100644
--- a/ldap/servers/plugins/retrocl/retrocl.c
+++ b/ldap/servers/plugins/retrocl/retrocl.c
@@ -470,8 +470,8 @@ static int retrocl_start (Slapi_PBlock *pb)
 
         retrocl_nattributes = n;
 
-        retrocl_attributes = (char **)slapi_ch_calloc(n, sizeof(char *));
-        retrocl_aliases = (char **)slapi_ch_calloc(n, sizeof(char *));
+        retrocl_attributes = (char **)slapi_ch_calloc(n + 1, sizeof(char *));
+        retrocl_aliases = (char **)slapi_ch_calloc(n + 1, sizeof(char *));
 
         slapi_log_err(SLAPI_LOG_PLUGIN, RETROCL_PLUGIN_NAME, "retrocl_start - Attributes:\n");
 
-- 
2.9.3