1) Fix the case we have less arguments for format string than we expected.

2) Return error on unsupported format specs.
(both according to POSIX)

PR:     93197
This commit is contained in:
Andrey A. Chernov 2014-10-07 06:34:05 +00:00
parent e15d3f3c09
commit 097c578c1e

View File

@ -103,9 +103,6 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp,
ptr = fmt;
while (*ptr != 0) {
if (*buf == 0)
break;
c = *ptr++;
if (c != '%') {
@ -123,7 +120,6 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp,
label:
c = *ptr++;
switch (c) {
case 0:
case '%':
if (*buf++ != '%')
return (NULL);
@ -600,6 +596,9 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp,
while (isspace_l((unsigned char)*buf, locale))
buf++;
break;
default:
return (NULL);
}
}