From 284adfe2e24f982705a3c70219b7bc8dbb58375a Mon Sep 17 00:00:00 2001 From: Pavel Kiryukhin Date: Mon, 17 Feb 2020 12:24:48 +0300 Subject: ipmi_sel_set_time: fix strptime() return check The current behavior: - correct date format is not accepted by "sel time set". - incorrect date format that looks correct is accepted, but time is not set correctly. - commands like ipmitool sel time set "11/22/2013 trash" are accepted. --- lib/ipmi_sel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/ipmi_sel.c b/lib/ipmi_sel.c index b6b8da1..6f509d0 100644 --- a/lib/ipmi_sel.c +++ b/lib/ipmi_sel.c @@ -2762,7 +2762,7 @@ ipmi_sel_set_time(struct ipmi_intf * intf, const char * time_string) else { bool error = true; /* Assume the string is invalid */ /* Now let's extract time_t from the supplied string */ - if (!strptime(time_string, time_format, &tm)) { + if (strptime(time_string, time_format, &tm) != NULL) { tm.tm_isdst = (-1); /* look up DST information */ t = mktime(&tm); if (t >= 0) { -- cgit v1.2.1