Blame SOURCES/0030-Issue-4884-server-crashes-when-dnaInterval-attribute.patch

038107
From df0ccce06259b9ef06d522e61da4e3ffcbbf5016 Mon Sep 17 00:00:00 2001
038107
From: Mark Reynolds <mreynolds@redhat.com>
038107
Date: Wed, 25 Aug 2021 16:54:57 -0400
038107
Subject: [PATCH] Issue 4884 - server crashes when dnaInterval attribute is set
038107
 to zero
038107
038107
Bug Description:
038107
038107
A division by zero crash occurs if the dnaInterval is set to zero
038107
038107
Fix Description:
038107
038107
Validate the config value of dnaInterval and adjust it to the
038107
default/safe value of "1" if needed.
038107
038107
relates: https://github.com/389ds/389-ds-base/issues/4884
038107
038107
Reviewed by: tbordaz(Thanks!)
038107
---
038107
 ldap/servers/plugins/dna/dna.c | 7 +++++++
038107
 1 file changed, 7 insertions(+)
038107
038107
diff --git a/ldap/servers/plugins/dna/dna.c b/ldap/servers/plugins/dna/dna.c
038107
index 928a3f54a..c983ebdd0 100644
038107
--- a/ldap/servers/plugins/dna/dna.c
038107
+++ b/ldap/servers/plugins/dna/dna.c
038107
@@ -1025,7 +1025,14 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry *e, int apply)
038107
 
038107
     value = slapi_entry_attr_get_charptr(e, DNA_INTERVAL);
038107
     if (value) {
038107
+        errno = 0;
038107
         entry->interval = strtoull(value, 0, 0);
038107
+        if (entry->interval == 0 || errno == ERANGE) {
038107
+            slapi_log_err(SLAPI_LOG_WARNING, DNA_PLUGIN_SUBSYSTEM,
038107
+                          "dna_parse_config_entry - Invalid value for dnaInterval (%s), "
038107
+                          "Using default value of 1\n", value);
038107
+            entry->interval = 1;
038107
+        }
038107
         slapi_ch_free_string(&value);
038107
     }
038107
 
038107
-- 
038107
2.31.1
038107