mirror of
https://github.com/BotChain-Robots/firmware.git
synced 2026-07-08 09:37:21 +02:00
Flatbuffer validation
This commit is contained in:
@@ -100,6 +100,13 @@ void CommunicationRouter::update_leader() {
|
||||
}
|
||||
|
||||
void CommunicationRouter::route(uint8_t* buffer, const size_t length) const {
|
||||
flatbuffers::Verifier verifier(buffer, length);
|
||||
bool ok = Messaging::VerifyMPIMessageBuffer(verifier);
|
||||
if (!ok) { // This could be moved to just be called on wireline data to save cpu cycles.
|
||||
ESP_LOGW(TAG, "route: got an invalid MPI message, disregarding");
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& mpi_message = Flatbuffers::MPIMessageBuilder::parse_mpi_message(buffer);
|
||||
|
||||
if (mpi_message->destination() == m_module_id) {
|
||||
|
||||
Reference in New Issue
Block a user