summaryrefslogtreecommitdiff
path: root/strftime.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-24 15:12:56 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-24 15:12:56 +0000
commit24602147809f793d9e4086bd2f2e732a35264fb8 (patch)
treeb8a39281a3e639ebd506dc378e77ea6540be4061 /strftime.c
parentf4f7d49705bcea302007203e7401b8e373356c4f (diff)
strftime.c: set buffer length
* strftime.c (FMTV): set the buffer length before appending to keep just put part. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'strftime.c')
-rw-r--r--strftime.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/strftime.c b/strftime.c
index 42761f0d7c..81e56d1f7b 100644
--- a/strftime.c
+++ b/strftime.c
@@ -326,6 +326,7 @@ rb_strftime_with_timespec(VALUE ftime, const char *format, size_t format_len,
const char *fmts = FMT_PADDING(fmt, def_pad); \
precision = FMT_PRECISION(def_prec); \
tmp = format_value(fmts, tmp, precision); \
+ rb_str_set_len(ftime, s-start); \
rb_str_append(ftime, tmp); \
RSTRING_GETMEM(ftime, s, len); \
endp = (start = s) + rb_str_capacity(ftime); \