summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/stringio/stringio.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c
index 191c1024c4..4c997dcd04 100644
--- a/ext/stringio/stringio.c
+++ b/ext/stringio/stringio.c
@@ -721,7 +721,7 @@ strio_ungetc(VALUE self, VALUE c)
}
}
/* get logical position */
- lpos = 0; p = RSTRING_PTR(ptr->string); pend = p + ptr->pos - 1;
+ lpos = 0; p = RSTRING_PTR(ptr->string); pend = p + ptr->pos;
for (;;) {
clen = rb_enc_mbclen(p, pend, enc);
if (p+clen >= pend) break;