diff --git a/array.c b/array.c index adb32811a5..5443268c1a 100644 --- a/array.c +++ b/array.c @@ -2368,7 +2368,9 @@ rb_ary_join(VALUE ary, VALUE sep) len += RSTRING_LEN(tmp); } - result = rb_str_buf_new(len); + result = rb_str_new(0, len); + rb_str_set_len(result, 0); + if (taint) OBJ_TAINT(result); ary_join_0(ary, sep, RARRAY_LEN(ary), result);