diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/range.c | 2 | ||||
| -rw-r--r-- | src/sprintf.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/range.c b/src/range.c index 6fe7964fe..085d5b1c0 100644 --- a/src/range.c +++ b/src/range.c @@ -286,7 +286,7 @@ mrb_range_beg_len(mrb_state *mrb, mrb_value range, mrb_int *begp, mrb_int *lenp, if (end > len) end = len; } if (end < 0) end += len; - if (!r->excl) end++; /* include end point */ + if (!r->excl && end < len) end++; /* include end point */ len = end - beg; if (len < 0) len = 0; diff --git a/src/sprintf.c b/src/sprintf.c index 630875a88..0e8ac830f 100644 --- a/src/sprintf.c +++ b/src/sprintf.c @@ -671,7 +671,7 @@ retry: tmp = mrb_check_string_type(mrb, val); if (!mrb_nil_p(tmp)) { if (RSTRING_LEN(tmp) != 1 ) { - mrb_raise(mrb, E_ARGUMENT_ERROR, "%%c requires a character"); + mrb_raise(mrb, E_ARGUMENT_ERROR, "%c requires a character"); } c = RSTRING_PTR(tmp)[0]; n = 1; |
