zrhoffman / rpms / 389-ds-base

Forked from rpms/389-ds-base 3 years ago
Clone

Blame SOURCES/0017-Issue-4483-heap-use-after-free-in-slapi_be_getsuffix.patch

be9751
From 1386b140d8cc81d37fdea6593487fe542587ccac Mon Sep 17 00:00:00 2001
be9751
From: Mark Reynolds <mreynolds@redhat.com>
be9751
Date: Wed, 9 Dec 2020 09:52:08 -0500
be9751
Subject: [PATCH] Issue 4483 - heap-use-after-free in slapi_be_getsuffix
be9751
be9751
Description:  heap-use-after-free in slapi_be_getsuffix after disk
be9751
              monitoring runs. This feature is freeing a list of
be9751
              backends which it does not need to do.
be9751
be9751
Fixes: https://github.com/389ds/389-ds-base/issues/4483
be9751
be9751
Reviewed by: firstyear & tbordaz(Thanks!!)
be9751
---
be9751
 ldap/servers/slapd/daemon.c | 13 +------------
be9751
 1 file changed, 1 insertion(+), 12 deletions(-)
be9751
be9751
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
be9751
index 49199e4df..691f77570 100644
be9751
--- a/ldap/servers/slapd/daemon.c
be9751
+++ b/ldap/servers/slapd/daemon.c
be9751
@@ -606,12 +606,6 @@ disk_monitoring_thread(void *nothing __attribute__((unused)))
be9751
             now = start;
be9751
             while ((now - start) < grace_period) {
be9751
                 if (g_get_shutdown()) {
be9751
-                    be_index = 0;
be9751
-                    if (be_list[be_index] != NULL) {
be9751
-                        while ((be = be_list[be_index++])) {
be9751
-                            slapi_be_free(&be);
be9751
-                        }
be9751
-                    }
be9751
                     slapi_ch_array_free(dirs);
be9751
                     dirs = NULL;
be9751
                     return;
be9751
@@ -706,12 +700,7 @@ disk_monitoring_thread(void *nothing __attribute__((unused)))
be9751
                 }
be9751
             }
be9751
         }
be9751
-        be_index = 0;
be9751
-        if (be_list[be_index] != NULL) {
be9751
-            while ((be = be_list[be_index++])) {
be9751
-                slapi_be_free(&be);
be9751
-            }
be9751
-        }
be9751
+
be9751
         slapi_ch_array_free(dirs);
be9751
         dirs = NULL; /* now it is not needed but the code may be changed in the future and it'd better be more robust */
be9751
         g_set_shutdown(SLAPI_SHUTDOWN_DISKFULL);
be9751
-- 
be9751
2.26.2
be9751