Problem
nmea_validate_checksum() in firmware/main/nmea_parser.hpp:78 passes nmea to memchr() without checking if it's NULL first:
inline bool
nmea_validate_checksum (const char* nmea, size_t len) {
const char* checksum_ptr = (const char*)memchr (nmea, '*', len);
If nmea is NULL, this is undefined behavior. While nmea_parse() checks len < 6 || nmea[0] != '$', if nmea is NULL then nmea[0] would be UB before that check.
Severity
LOW - Only reachable if caller passes NULL, which current callers don't do.
Suggested Fix
Add NULL check at start of function:
inline bool
nmea_validate_checksum (const char* nmea, size_t len) {
if (!nmea) {
return false;
}
// ... rest of function
This is a pre-existing issue noted in PR #53 review.
Problem
nmea_validate_checksum()infirmware/main/nmea_parser.hpp:78passesnmeatomemchr()without checking if it's NULL first:If
nmeais NULL, this is undefined behavior. Whilenmea_parse()checkslen < 6 || nmea[0] != '$', ifnmeais NULL thennmea[0]would be UB before that check.Severity
LOW - Only reachable if caller passes NULL, which current callers don't do.
Suggested Fix
Add NULL check at start of function:
This is a pre-existing issue noted in PR #53 review.