summaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/io.c b/io.c
index 460973ff2..9bdad5496 100644
--- a/io.c
+++ b/io.c
@@ -1132,11 +1132,13 @@ io_readpartial(argc, argv, io)
READ_CHECK(fptr->f);
if (RSTRING(str)->len != len) {
+ modified:
rb_raise(rb_eRuntimeError, "buffer string modified");
}
n = read_buffered_data(RSTRING(str)->ptr, len, fptr->f);
if (n <= 0) {
again:
+ if (RSTRING(str)->len != len) goto modified;
TRAP_BEG;
n = read(fileno(fptr->f), RSTRING(str)->ptr, len);
TRAP_END;