added length check

This commit is contained in:
Robin Müller 2023-03-06 14:01:45 +01:00
parent 2c5af91db1
commit e9d9f44605
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814

View File

@ -68,6 +68,9 @@ ReturnValue_t CServiceHealthCommanding::prepareCommand(CommandMessage *message,
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = returnvalue::OK;
switch (subservice) { switch (subservice) {
case (Subservice::COMMAND_SET_HEALTH): { case (Subservice::COMMAND_SET_HEALTH): {
if(tcDataLen != sizeof(object_id_t) + sizeof(HasHealthIF::HealthState)) {
return CommandingServiceBase::INVALID_TC;
}
HealthSetCommand healthCommand; HealthSetCommand healthCommand;
result = healthCommand.deSerialize(&tcData, &tcDataLen, SerializeIF::Endianness::BIG); result = healthCommand.deSerialize(&tcData, &tcDataLen, SerializeIF::Endianness::BIG);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {