Ver Fonte

Ticket 49380 - Crash when adding invalid replication agreement

    Bug Description:  If you add a replication agreement with an invalid "replicaEnabled" value
                      the server crashes when freeing the replica schedule.  This is because the
                      schedule never gets allocated before the rror conidtion is hit, and then
                      it get dereferenced.

    Fix Description:  Check for a NULL schedule before trying to destroy it.

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

    Reviewed by: tbordaz(Thanks!)
Mark Reynolds há 8 anos atrás
pai
commit
610db4727e
1 ficheiros alterados com 8 adições e 1 exclusões
  1. 8 1
      ldap/servers/plugins/replication/repl5_schedule.c

+ 8 - 1
ldap/servers/plugins/replication/repl5_schedule.c

@@ -130,6 +130,9 @@ schedule_destroy(Schedule *s)
 {
 {
     int i;
     int i;
 
 
+    if (s == NULL) {
+        return;
+    }
     /* unschedule update window event if exists */
     /* unschedule update window event if exists */
     unschedule_window_state_change_event(s);
     unschedule_window_state_change_event(s);
 
 
@@ -172,11 +175,15 @@ free_schedule_list(schedule_item **schedule_list)
 int
 int
 schedule_set(Schedule *sch, Slapi_Attr *attr)
 schedule_set(Schedule *sch, Slapi_Attr *attr)
 {
 {
-    int return_value;
+    int return_value = -1;
     schedule_item *si = NULL;
     schedule_item *si = NULL;
     schedule_item *new_schedule_list = NULL;
     schedule_item *new_schedule_list = NULL;
     int valid = 1;
     int valid = 1;
 
 
+    if (sch == NULL) {
+        return return_value;
+    }
+
     if (NULL != attr) {
     if (NULL != attr) {
         int ind;
         int ind;
         Slapi_Value *sval;
         Slapi_Value *sval;