summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/io.c b/io.c
index 4ac42dabbf..ec37d03c06 100644
--- a/io.c
+++ b/io.c
@@ -1010,9 +1010,10 @@ read_all(fptr, siz, str)
if (siz == 0) siz = BUFSIZ;
if (NIL_P(str)) {
- str = rb_tainted_str_new(0, siz);
+ str = rb_str_new(0, siz);
}
else {
+ StringValue(str);
rb_str_resize(str, siz);
}
for (;;) {
@@ -1033,6 +1034,7 @@ read_all(fptr, siz, str)
rb_str_resize(str, siz);
}
if (bytes != siz) rb_str_resize(str, bytes);
+ OBJ_TAINT(str);
return str;
}
@@ -1074,7 +1076,7 @@ io_read(argc, argv, io)
}
if (NIL_P(str)) {
- str = rb_str_new(0, len);
+ str = rb_tainted_str_new(0, len);
}
else {
StringValue(str);