79665560

Date: 2025-06-14 04:09:48
Score: 1.5
Natty:
Report link

Since this gets viewed a lot, even though it's old, I'll note for new programmers: this parsing code is technically correct but it is fragile: it will not tolerate any errors or variation in the nmea string and can crash for a variety of reasons. For example if any call to strtok_single() returns NULL, the strcpy will attempt to de-reference a null pointer (and crash). This will happen if any delimiter is not found. It's also better practice to use strncpy rather than strcpy for copying strings to avoid a potential buffer overrun.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Single line (0.5):
  • Low reputation (1):
Posted by: David Albert