From 831202f85c7b42ba90fa00ca23e714815d666b39 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 17 May 2014 23:22:28 +0000 Subject: io.c: buffer must be modifiable * io.c (io_setstrbuf): always check if the buffer is modifiable. [ruby-core:62643] [Bug #9847] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'io.c') diff --git a/io.c b/io.c index 533989cb62..5499086448 100644 --- a/io.c +++ b/io.c @@ -2370,8 +2370,8 @@ io_setstrbuf(VALUE *str, long len) VALUE s = StringValue(*str); long clen = RSTRING_LEN(s); if (clen >= len) { + rb_str_modify(s); if (clen != len) { - rb_str_modify(s); rb_str_set_len(s, len); } return; -- cgit v1.2.3