From cbc0062992a838851afb1bb6cc67f32a2517b83d Mon Sep 17 00:00:00 2001 From: Yuri Pankov Date: Sat, 13 Oct 2018 16:25:28 +0000 Subject: [PATCH] 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 --- lib/libc/stdtime/strptime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libc/stdtime/strptime.c b/lib/libc/stdtime/strptime.c index 6214398f09e..78cef6bf839 100644 --- a/lib/libc/stdtime/strptime.c +++ b/lib/libc/stdtime/strptime.c @@ -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;