about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-07-28 19:10:22 +0000
committerUlrich Drepper <drepper@redhat.com>2007-07-28 19:10:22 +0000
commitae1ad762f0687afb37761085cb6e83305afe4521 (patch)
tree973b7a88bdce24bdb712ad21f82a569900e7a733
parentfa69dc9caf8fff3e7ebb6da6dbbe144b314277f4 (diff)
downloadglibc-ae1ad762f0687afb37761085cb6e83305afe4521.tar.gz
glibc-ae1ad762f0687afb37761085cb6e83305afe4521.tar.xz
glibc-ae1ad762f0687afb37761085cb6e83305afe4521.zip
[BZ #4772]
	* time/strptime_l.c (__strptime_internal): Silently ignore
	strftime modifiers and field width in recursive calls.
-rw-r--r--ChangeLog4
-rw-r--r--time/strptime_l.c12
2 files changed, 16 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index b2d9424fc4..c591d31957 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2007-07-20  Jakub Jelinek  <jakub@redhat.com>
 
+	[BZ #4772]
+	* time/strptime_l.c (__strptime_internal): Silently ignore
+	strftime modifiers and field width in recursive calls.
+
 	* include/time.h (enum ptime_locale_status): Remove.
 	(__strptime_internal): Remove decided and era_cnt arguments,
 	add statep argument.
diff --git a/time/strptime_l.c b/time/strptime_l.c
index 0305fd56cb..59a557c22b 100644
--- a/time/strptime_l.c
+++ b/time/strptime_l.c
@@ -330,6 +330,18 @@ __strptime_internal (rp, fmt, tmp, statep LOCALE_PARAM)
 	}
 
       ++fmt;
+      if (statep != NULL)
+	{
+	  /* In recursive calls silently discard strftime modifiers.  */
+	  while (*fmt == '-' || *fmt == '_' || *fmt == '0'
+		 || *fmt == '^' || *fmt == '#')
+	    ++fmt;
+
+	  /* And field width.  */
+	  while (*fmt >= '0' && *fmt <= '9')
+	    ++fmt;
+	}
+
 #ifndef _NL_CURRENT
       /* We need this for handling the `E' modifier.  */
     start_over: