Skip to content

Commit ed494cf

Browse files
committed
Initialize type arrays
the type[6] array is used with strcmp. Currently this array isn't initialized, so it contains previous stack content, and if this content isn't '\0' then the strcmp might fail for no reason.
1 parent b2c60df commit ed494cf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

minmea.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ bool minmea_scan(const char *sentence, const char *format, ...)
336336

337337
bool minmea_talker_id(char talker[3], const char *sentence)
338338
{
339-
char type[6];
339+
char type[6] = {0};
340340
if (!minmea_scan(sentence, "t", type))
341341
return false;
342342

@@ -352,7 +352,7 @@ enum minmea_sentence_id minmea_sentence_id(const char *sentence, bool strict)
352352
if (!minmea_check(sentence, strict))
353353
return MINMEA_INVALID;
354354

355-
char type[6];
355+
char type[6] = {0};
356356
if (!minmea_scan(sentence, "t", type))
357357
return MINMEA_INVALID;
358358

0 commit comments

Comments
 (0)