summaryrefslogtreecommitdiff
path: root/sprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sprintf.c')
-rw-r--r--sprintf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sprintf.c b/sprintf.c
index f005ad6af4..b59e3d1401 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -298,6 +298,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
result = rb_str_buf_new(bsiz);
rb_enc_copy(result, fmt);
buf = RSTRING_PTR(result);
+ memset(buf, 0, bsiz);
for (; p < end; p++) {
const char *t;
@@ -850,7 +851,6 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
rb_str_resize(result, blen);
if (tainted) OBJ_TAINT(result);
- rb_enc_associate(result, enc);
return result;
}