1) For already non-standard %z extension implement GNU compatible formats:

+hh and -hh.
2) Check for incorrect values for %z.

MFC after:      7 days
This commit is contained in:
Andrey A. Chernov 2016-09-21 15:47:40 +00:00
parent 05761ebcf1
commit 5fca7e1f13
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=306109

View File

@ -582,10 +582,16 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp,
i *= 10;
i += *buf - '0';
buf++;
} else if (len == 2) {
i *= 100;
break;
} else
return (NULL);
}
if (i > 1400 || (sign == -1 && i > 1200) ||
(i % 100) >= 60)
return (NULL);
tm->tm_hour -= sign * (i / 100);
tm->tm_min -= sign * (i % 100);
*GMTp = 1;