summaryrefslogtreecommitdiffhomepage
path: root/src/string.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2015-12-12 12:00:04 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2015-12-12 16:33:48 +0900
commitad333cd191f736b312cec090e31d91a382a7cb20 (patch)
tree7e042f9d00cebc109c74581cf89811d46d3f2601 /src/string.c
parentb9e5be6a1c5387d556d82d068f7d93a349f1a9a3 (diff)
downloadmruby-ad333cd191f736b312cec090e31d91a382a7cb20.tar.gz
mruby-ad333cd191f736b312cec090e31d91a382a7cb20.zip
mrb_str_len_to_inum: converting may not be terminated by NUL; fix #3044
Diffstat (limited to 'src/string.c')
-rw-r--r--src/string.c3
1 files changed, 2 insertions, 1 deletions
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;