hdb: Initialize ‘tm’ structure

‘tm’ must be initialized prior to calling strptime().

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
This commit is contained in:
Joseph Sutton
2023-09-21 09:08:33 +12:00
committed by Nico Williams
parent 806bf5f571
commit d71035e2d1

View File

@@ -2902,9 +2902,11 @@ ptime(const char *s)
char *rest;
int at_s;
memset(&at_tm, 0, sizeof at_tm);
if ((rest = strptime(s, "%Y-%m-%dT%H:%M:%S", &at_tm)) != NULL &&
rest[0] == '\0')
return mktime(&at_tm);
memset(&at_tm, 0, sizeof at_tm);
if ((rest = strptime(s, "%Y%m%d%H%M%S", &at_tm)) != NULL && rest[0] == '\0')
return mktime(&at_tm);
if ((at_s = parse_time(s, "s")) != -1)