This is the mail archive of the
cygwin-cvs@cygwin.com
mailing list for the Cygwin project.
[newlib-cygwin] winsup/cygwin/libc/strptime.cc(__strptime) fix %F width
- From: Corinna Vinschen <corinna at sourceware dot org>
- To: cygwin-cvs at sourceware dot org
- Date: 29 Aug 2017 19:10:38 -0000
- Subject: [newlib-cygwin] winsup/cygwin/libc/strptime.cc(__strptime) fix %F width
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=d8e2463c75d946f30af19705ad922085185784a5
commit d8e2463c75d946f30af19705ad922085185784a5
Author: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
Date: Tue Aug 29 11:25:43 2017 -0600
winsup/cygwin/libc/strptime.cc(__strptime) fix %F width
Diff:
---
winsup/cygwin/libc/strptime.cc | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/winsup/cygwin/libc/strptime.cc b/winsup/cygwin/libc/strptime.cc
index 7c6cc20..081aca3 100644
--- a/winsup/cygwin/libc/strptime.cc
+++ b/winsup/cygwin/libc/strptime.cc
@@ -413,13 +413,15 @@ literal:
case 'F': /* The date as "%Y-%m-%d". */
{
LEGAL_ALT(0);
- ymd |= SET_YMD;
char *tmp = __strptime ((const char *) bp, "%Y-%m-%d",
tm, era_info, alt_digits,
locale);
- if (tmp && (uint) (tmp - (char *) bp) > width)
+ /* width max chars converted, default 10, < 6 => 6 */
+ if (tmp && (char *) bp +
+ (!width ? 10 : width < 6 ? 6 : width) < tmp)
return NULL;
bp = (const unsigned char *) tmp;
+ ymd |= SET_YMD;
continue;
}