mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 18:05:06 -05:00
getdate+nts+rtc: avoid some coverity false positives
Modify the code to avoid making the following calls incorrectly reported as important findings by the coverity static analyzer: - memset() of size 0 at the end of an array - mktime() on a struct tm that has uninitialized tm_yday
This commit is contained in:
@@ -907,6 +907,7 @@ get_date (const char *p, const time_t *now)
|
||||
yyHour = tmp->tm_hour;
|
||||
yyMinutes = tmp->tm_min;
|
||||
yySeconds = tmp->tm_sec;
|
||||
memset(&tm, 0, sizeof (tm));
|
||||
tm.tm_isdst = tmp->tm_isdst;
|
||||
yyMeridian = MER24;
|
||||
yyRelSeconds = 0;
|
||||
@@ -943,7 +944,6 @@ get_date (const char *p, const time_t *now)
|
||||
tm.tm_hour += yyRelHour;
|
||||
tm.tm_min += yyRelMinutes;
|
||||
tm.tm_sec += yyRelSeconds;
|
||||
tm.tm_wday = 0;
|
||||
|
||||
/* Let mktime deduce tm_isdst if we have an absolute timestamp,
|
||||
or if the relative timestamp mentions days, months, or years. */
|
||||
|
||||
Reference in New Issue
Block a user