-/* $OpenBSD: misc.c,v 1.213 2026/03/03 09:57:25 dtucker Exp $ */
+/* $OpenBSD: misc.c,v 1.214 2026/05/27 13:54:15 tb Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
* Copyright (c) 2005-2020 Damien Miller. All rights reserved.
if ((cp = strptime(buf, fmt, &tm)) == NULL || *cp != '\0')
return SSH_ERR_INVALID_FORMAT;
if (is_utc) {
- if ((tt = timegm(&tm)) < 0)
+ tm.tm_wday = -1;
+ if ((tt = timegm(&tm)) == -1 && tm.tm_wday == -1)
return SSH_ERR_INVALID_FORMAT;
} else {
- if ((tt = mktime(&tm)) < 0)
+ tm.tm_wday = -1;
+ if ((tt = mktime(&tm)) == -1 && tm.tm_wday == -1)
return SSH_ERR_INVALID_FORMAT;
}
/* success */