diff options
author | 2014-10-02 23:50:11 +0000 | |
---|---|---|
committer | 2014-10-02 23:50:11 +0000 | |
commit | ee07586f9f055383bfd71fd17006c4db163dec43 (patch) | |
tree | efc1474a2841d89165ed4db4a0242b7398837e04 /lib/libc | |
parent | when no domain is specified in MAIL FROM or RCPT TO, assume local user (diff) | |
download | wireguard-openbsd-ee07586f9f055383bfd71fd17006c4db163dec43.tar.xz wireguard-openbsd-ee07586f9f055383bfd71fd17006c4db163dec43.zip |
Fix a crash when there is text after a failed %Z conversion in strptime.
jmates at ee dot washington dot edu reported this bug and provided a patch.
This is a slightly modified version of the patch that only contains the
bug fix.
ok millert@, otto@
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/time/strptime.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/libc/time/strptime.c b/lib/libc/time/strptime.c index 8ba53ec4f2b..68e3ecf3906 100644 --- a/lib/libc/time/strptime.c +++ b/lib/libc/time/strptime.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strptime.c,v 1.16 2014/02/13 23:16:03 millert Exp $ */ +/* $OpenBSD: strptime.c,v 1.17 2014/10/02 23:50:11 doug Exp $ */ /* $NetBSD: strptime.c,v 1.12 1998/01/20 21:39:40 mycroft Exp $ */ /*- @@ -413,15 +413,16 @@ literal: ep = _find_string(bp, &i, (const char * const *)tzname, NULL, 2); - if (ep != NULL) { - tm->tm_isdst = i; + if (ep == NULL) + return (NULL); + + tm->tm_isdst = i; #ifdef TM_GMTOFF - tm->TM_GMTOFF = -(timezone); + tm->TM_GMTOFF = -(timezone); #endif #ifdef TM_ZONE - tm->TM_ZONE = tzname[i]; + tm->TM_ZONE = tzname[i]; #endif - } bp = ep; } continue; |