浏览代码

minmea_getdate: use pointer dereferencing for memset (safer)

Kosma Moczek 3 年之前
父节点
当前提交
f2bd34c82a
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      minmea.c

+ 1 - 1
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)
         return -1;
 
-    memset(out, 0, sizeof(struct tm));
+    memset(out, 0, sizeof(*out));
     if (date->year < 80) {
         out->tm_year = 2000 + date->year - 1900; // 2000-2079
     } else if (date->year >= 1900) {