NMEA0183
NMEA0183 copied to clipboard
Parsing NMEA messages should be robust against to much fields
Currently when you parse an NMEA0183 message (tNMEA0183Msg::SetMessage) there is no check against the field count. So if the message (accidently) contains more then 20 fields it will overwrite data leading to crashes. So there should be something like
if (_FieldCount >= MAX_NMEA0183_MSG_FIELDS){ Clear(); return false; } before line 101 of NMEA0183Message.cpp.
Thanks. Added it after increment.
Maybe better before - otherwise you allow one field less...
You are rigth, but then it should be before line Fields[_FieldCount]=iData+1; // Set start of field On my code that is line 100.
exactly... that's what I currently do.
OK, now it is updated.