summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/io.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/io.c b/src/io.c
index 51a659f0e..2a24b18a4 100644
--- a/src/io.c
+++ b/src/io.c
@@ -625,6 +625,9 @@ mrb_io_sysread(mrb_state *mrb, mrb_value io)
if (maxlen < 0) {
return mrb_nil_value();
}
+ else if (maxlen == 0) {
+ return mrb_str_new(mrb, NULL, maxlen);
+ }
if (mrb_nil_p(buf)) {
buf = mrb_str_new(mrb, NULL, maxlen);