Prevent Companion crash if input data is smaller than required (#4309)

This commit is contained in:
Damjan Adamic
2017-01-28 13:47:45 +01:00
committed by Bertrand Songis
parent 2fbe5a78d1
commit d1547dd32d
3 changed files with 10 additions and 2 deletions
@@ -171,7 +171,9 @@ template <class T, class M>
bool OpenTxEepromInterface::loadFromByteArray(T & dest, const QByteArray & data, uint8_t version, uint32_t variant)
{
M manager(dest, board, version, variant);
manager.Import(data);
if (manager.Import(data) != 0) {
return false;
}
// manager.Dump(); // Dumps the structure so that it's easy to check with firmware datastructs.h
return true;
}