strptime: disallow zero hour for %I (defined by POSIX as [01,12]) and %l

(extension, defined in strftime(3) as 1-12).

Approved by:	re (gjb), kib (mentor)
Differential Revision:	https://reviews.freebsd.org/D17543
This commit is contained in:
Yuri Pankov 2018-10-13 16:25:28 +00:00
parent 84cf7c1df7
commit cbc0062992

View File

@ -291,7 +291,7 @@ label:
if (c == 'H' || c == 'k') {
if (i > 23)
return (NULL);
} else if (i > 12)
} else if (i == 0 || i > 12)
return (NULL);
tm->tm_hour = i;