Skip to content

make NMEA parser more robust #20

Description

@bomilkar

Both parse_NMEA_sensor() and parse_NMEA_command() can easily run into Segmentation Fault.
Look at the code and think what happens if you send parse_NMEA_sensor() a sentence (fraction) like this:
$POV,E,Q,E,Q
It will run into a Segmentation Fault when it reaches the end of the line.
Similarly for parse_NMEA_command() when it receives
CC,M

I think variod should avoid Segmentation Faults if at all possible.

A message like this
BLAH,E,1.1,Qjhsadjahdskhd,100.0,Puwezqez,*99
It will set TE to 1.1, dynamic pressure to 100.0 and Static to 0 ignoring the checksum error and the other garbage. I think we should apply reasonable checks before accepting sentences.

Then eliminate the memory leak. I count 6 malloc() and not a single free().

In the process of fixing the above it may turn out to be best to let the 2 parser functions work on one sentence at a time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions