Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Sep 2016 15:47:40 +0000 (UTC)
From:      "Andrey A. Chernov" <ache@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r306109 - head/lib/libc/stdtime
Message-ID:  <201609211547.u8LFledI021725@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ache
Date: Wed Sep 21 15:47:40 2016
New Revision: 306109
URL: https://svnweb.freebsd.org/changeset/base/306109

Log:
  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

Modified:
  head/lib/libc/stdtime/strptime.c

Modified: head/lib/libc/stdtime/strptime.c
==============================================================================
--- head/lib/libc/stdtime/strptime.c	Wed Sep 21 15:29:35 2016	(r306108)
+++ head/lib/libc/stdtime/strptime.c	Wed Sep 21 15:47:40 2016	(r306109)
@@ -582,10 +582,16 @@ label:
 					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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201609211547.u8LFledI021725>