Correctly shift received data

pull/25/head
Paul Hollinsky 2019-11-19 17:07:26 +01:00
parent 4821a957dd
commit fe7c50f8a3
1 changed files with 2 additions and 1 deletions

View File

@ -59,7 +59,8 @@ std::shared_ptr<FlexRayMessage> HardwareFlexRayPacket::DecodeToMessage(const std
if(int64_t(numBytes) != int64_t(data->Length) - 4) {
// This is an error, probably need to flag it
} else {
msg->data = std::vector<uint8_t>((const uint8_t*)(data + 1), (const uint8_t*)(data + 1) + numBytes);
const uint8_t* dataStart = (const uint8_t*)(data) - 4 + sizeof(HardwareFlexRayPacket);
msg->data = std::vector<uint8_t>(dataStart, dataStart + numBytes);
}
}
}