diff --git a/inc/ErrorHandler.hpp b/inc/ErrorHandler.hpp index adffdc132bffd5aa7830bcbd414f415a643c6340..95c9138e1824f52e1acf152aaa0c7c4b2d8d7e73 100644 --- a/inc/ErrorHandler.hpp +++ b/inc/ErrorHandler.hpp @@ -51,7 +51,6 @@ public: * A string is larger than the largest allowed string */ StringTooLarge = 4, - /** * An error in the header of a packet makes it unable to be parsed */ diff --git a/src/Services/EventActionService.cpp b/src/Services/EventActionService.cpp index 63f3e9f1944ddfd80c40889c8741615b8fecde13..5938837c1479cdec832c009a24b1e7e44c49dfeb 100644 --- a/src/Services/EventActionService.cpp +++ b/src/Services/EventActionService.cpp @@ -13,12 +13,12 @@ void EventActionService::addEventActionDefinitions(Message message) { 19) { uint16_t index; for (index = 0; index < ECSS_EVENT_ACTION_STRUCT_ARRAY_SIZE; index++) { + // @todo: throw an error if it's full if (eventActionDefinitionArray[index].empty == true) { break; } } if (index < ECSS_EVENT_ACTION_STRUCT_ARRAY_SIZE) { - char data[ECSS_EVENT_SERVICE_STRING_SIZE]; eventActionDefinitionArray[index].empty = false; eventActionDefinitionArray[index].enabled = true; eventActionDefinitionArray[index].applicationId = message.readEnum16(); @@ -28,6 +28,7 @@ void EventActionService::addEventActionDefinitions(Message message) { if (message.dataSize - 4 > ECSS_EVENT_SERVICE_STRING_SIZE) { // Should this be >= ? ErrorHandler::reportInternalError(ErrorHandler::InternalErrorType::MessageTooLarge); } else { + char data[ECSS_EVENT_SERVICE_STRING_SIZE]; message.readString(data, message.dataSize); eventActionDefinitionArray[index].request = String<ECSS_EVENT_SERVICE_STRING_SIZE>( data);