summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-17 23:22:28 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-17 23:22:28 +0000
commit831202f85c7b42ba90fa00ca23e714815d666b39 (patch)
treea4191927060e62afc4311bc85d86fcffce27b48e /io.c
parente279eca4bdf1e4364308aee2ca504bbdf2b5d221 (diff)
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
Diffstat (limited to 'io.c')
-rw-r--r--io.c2
1 files changed, 1 insertions, 1 deletions
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;