diff --git a/src/Services/EventReportService.cpp b/src/Services/EventReportService.cpp index 86f3c8fbd369b18c84157b18dc25e7b0114abd3b..3e3c7af40a11f9468529ca0e91c719e7982f7839 100644 --- a/src/Services/EventReportService.cpp +++ b/src/Services/EventReportService.cpp @@ -51,12 +51,14 @@ EventReportService::highSeverityAnomalyReport(Event eventID, const uint8_t *data void EventReportService::enableReportGeneration(uint8_t length, Event *eventID) { // TC[5,5] /** - * @todo: Add informationEventReport with notification if failed start of execution - * according to standard 6.5.5.2.e + * @todo: Report an error if length>numberOfEvents */ - for (uint8_t i = 0; i < length; i++) { - stateOfEvents[static_cast<uint8_t> (eventID[i])] = 1; + if (length <= numberOfEvents) { + for (uint8_t i = 0; i < length; i++) { + stateOfEvents[static_cast<uint8_t> (eventID[i])] = 1; + } } + } void EventReportService::disableReportGeneration(uint8_t length, Event *eventID) {