fix: Add input validation to Schedule_Recalculate_PV and Schedule_Timer functions to prevent segmentation fault occurring in Schedule_Recalculate_PV() during application startup (#1259)

This commit is contained in:
Steve Karg
2026-03-12 10:21:29 -05:00
committed by GitHub
parent f525e7c484
commit 4499f17135
2 changed files with 18 additions and 5 deletions
@@ -122,6 +122,13 @@ static void testSchedule(void)
skip_fail_property_list);
Schedule_Recalculate_PV(
Schedule_Object(object_instance), BACNET_WEEKDAY_SUNDAY, &time_of_day);
/* targeted tests for NULL pointer and invalid day of week */
Schedule_Recalculate_PV(NULL, BACNET_WEEKDAY_SUNDAY, &time_of_day);
Schedule_Recalculate_PV(Schedule_Object(object_instance), 0, &time_of_day);
Schedule_Recalculate_PV(Schedule_Object(object_instance), 8, &time_of_day);
Schedule_Recalculate_PV(
Schedule_Object(object_instance), BACNET_WEEKDAY_SUNDAY, NULL);
Schedule_Timer(BACNET_MAX_INSTANCE, 0);
}
/**
* @}