From ad333cd191f736b312cec090e31d91a382a7cb20 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Sat, 12 Dec 2015 12:00:04 +0900 Subject: mrb_str_len_to_inum: converting may not be terminated by NUL; fix #3044 --- src/string.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/string.c b/src/string.c index 38aa6561e..3603d5ac7 100644 --- a/src/string.c +++ b/src/string.c @@ -2163,7 +2163,8 @@ mrb_str_len_to_inum(mrb_state *mrb, const char *str, size_t len, int base, int b n *= base; n += c; if (n > MRB_INT_MAX) { - mrb_raisef(mrb, E_ARGUMENT_ERROR, "string (%S) too big for integer", mrb_str_new_cstr(mrb, str)); + mrb_raisef(mrb, E_ARGUMENT_ERROR, "string (%S) too big for integer", + mrb_str_new(mrb, str, pend-str)); } } val = n; -- cgit v1.2.3