minmea_getdate: use pointer dereferencing for memset (safer)

This commit is contained in:
Kosma Moczek 2022-06-03 00:53:40 +02:00
parent 4ebbaef840
commit f2bd34c82a

View File

@ -617,7 +617,7 @@ int minmea_getdate(struct tm *out, const struct minmea_date *date, const struct
if (date->year == -1 || time_->hours == -1) if (date->year == -1 || time_->hours == -1)
return -1; return -1;
memset(out, 0, sizeof(struct tm)); memset(out, 0, sizeof(*out));
if (date->year < 80) { if (date->year < 80) {
out->tm_year = 2000 + date->year - 1900; // 2000-2079 out->tm_year = 2000 + date->year - 1900; // 2000-2079
} else if (date->year >= 1900) { } else if (date->year >= 1900) {