summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/io.c b/io.c
index a7e1047e7b..0c2ba4d0af 100644
--- a/io.c
+++ b/io.c
@@ -829,6 +829,9 @@ io_read(argc, argv, io)
rb_str_resize(str, 0);
return str;
}
+ if (len > RSTRING(str)->len) {
+ rb_str_resize(str,len);
+ }
}
READ_CHECK(fptr->f);