diff options
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -2084,7 +2084,10 @@ io_setstrbuf(VALUE *str, long len) VALUE s = StringValue(*str); long clen = RSTRING_LEN(s); if (clen >= len) { - if (clen != len) rb_str_set_len(s, len); + if (clen != len) { + rb_str_modify(s); + rb_str_set_len(s, len); + } return; } len -= clen; |