1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-25 17:25:18 +03:00

Make MSP_SET_TX_INFO not crash on malformed MSP messages

Since it will be used while the machine is armed and over telemetry,
we need to make sure a malformed request doesn't crash the FC.

Also, rename setRSSIMsp() to setRSSIFromMSP()
This commit is contained in:
Alberto García Hierro 2018-03-16 20:14:59 +00:00
parent f4db6341a8
commit 3022df24f5
3 changed files with 9 additions and 3 deletions

View file

@ -2257,7 +2257,13 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
case MSP_SET_TX_INFO:
{
setRSSIMsp(sbufReadU8(src));
// This message will be sent while the aircraft is
// armed. Better to guard ourselves against potentially
// malformed requests.
uint8_t rssi;
if (sbufReadU8Safe(&rssi, src)) {
setRSSIFromMSP(rssi);
}
}
break;