Open bomilkar opened 4 years ago
@linuxianer99 : I'll start working on this. Do you think I can do this in 1 commit and PR? I'll be a substantial change for nmea_parser.c and those require changes in variod.c to call the parser for each sentence at a time. I don't see how I can separate those changes.
For the most part addressed with https://github.com/Openvario/variod/pull/30
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.