summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdtime
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2014-10-07 06:34:05 +0000
committerache <ache@FreeBSD.org>2014-10-07 06:34:05 +0000
commitcdbe7846a912f2650f947b9b11644306f2c31de3 (patch)
tree849a064d8f1f1b32a2835192423b9198202b4eae /lib/libc/stdtime
parent19b981bc1304f22a4e8b3b97f98e6df5fefca782 (diff)
downloadFreeBSD-src-cdbe7846a912f2650f947b9b11644306f2c31de3.zip
FreeBSD-src-cdbe7846a912f2650f947b9b11644306f2c31de3.tar.gz
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
Diffstat (limited to 'lib/libc/stdtime')
-rw-r--r--lib/libc/stdtime/strptime.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/libc/stdtime/strptime.c b/lib/libc/stdtime/strptime.c
index e942e04..2be6358 100644
--- a/lib/libc/stdtime/strptime.c
+++ b/lib/libc/stdtime/strptime.c
@@ -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 @@ label:
while (isspace_l((unsigned char)*buf, locale))
buf++;
break;
+
+ default:
+ return (NULL);
}
}
OpenPOWER on IntegriCloud