From 60683816be0674fc3e0a07855f5c2de68c4db771 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 29 May 2012 08:28:04 +0000 Subject: strftime.c: fix colon modifier. partially borrowed from ext/date. * strftime.c (rb_strftime_with_timespec): colons are valid only for 'z' and must come just before it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- strftime.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'strftime.c') diff --git a/strftime.c b/strftime.c index ba65c87502..767a852727 100644 --- a/strftime.c +++ b/strftime.c @@ -758,8 +758,12 @@ rb_strftime_with_timespec(char *s, size_t maxsize, const char *format, rb_encodi goto again; case ':': - FLAG_FOUND(); - colons++; + { + size_t l = strspn(format, ":"); + if (l > 3 || format[l] != 'z') goto unknown; + colons = (int)l; + format += l - 1; + } goto again; case '0': -- cgit v1.2.3