minmea_getdate: use pointer dereferencing for memset (safer)
This commit is contained in:
parent
4ebbaef840
commit
f2bd34c82a
2
minmea.c
2
minmea.c
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user