aboutsummaryrefslogtreecommitdiffstats
path: root/sprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sprintf.c')
-rw-r--r--sprintf.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sprintf.c b/sprintf.c
index 40872c0c16..117c568d78 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -517,6 +517,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
VALUE sym = Qnil;
for (t = p; t < end && *t != '%'; t++) ;
+ if (t + 1 == end) ++t;
PUSH(p, t - p);
if (coderange != ENC_CODERANGE_BROKEN && scanned < blen) {
scanned += rb_str_coderange_scan_restartable(buf+scanned, buf+blen, enc, &coderange);