Disallow zero day of month from strptime("%d").

It is required by POSIX, specified in our man page, and followed by
Linux.

PR:	232072
Reported by:	miguel_tete17@hotmail.com
Sponsored by:	The FreeBSD Foundation
Approved by:	re (gjb)
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2018-10-08 18:45:40 +00:00
parent f3b515aea5
commit 92cbfb6395

View File

@ -419,7 +419,7 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp,
i += *buf - '0';
len--;
}
if (i > 31)
if (i == 0 || i > 31)
return (NULL);
tm->tm_mday = i;