summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
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 f7898b61d4..9fa241f6c3 100644
--- a/io.c
+++ b/io.c
@@ -1762,7 +1762,7 @@ appendline(rb_io_t *fptr, int delim, VALUE *strp, long *lp)
}
if (limit > 0 && limit == pending) {
char *p = fptr->rbuf+fptr->rbuf_off;
- char *pp = p + limit;
+ char *pp = p + limit - 1;
char *pl = rb_enc_left_char_head(p, pp, enc);
if (pl < pp) {