diff options
Diffstat (limited to 'ext/stringio/stringio.c')
-rw-r--r-- | ext/stringio/stringio.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index 4ff0e36c69..ce1d55fd46 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -728,8 +728,9 @@ strio_ungetc(VALUE self, VALUE c) p += clen; lpos++; } + clen = p - RSTRING_PTR(ptr->string); rb_str_update(ptr->string, lpos, ptr->pos ? 1 : 0, c); - ptr->pos = p - RSTRING_PTR(ptr->string); + ptr->pos = clen; return Qnil; } |