Skip to content

Commit

Permalink
mrb_str_len_to_inum: converting may not be terminated by NUL; fix #3044
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Dec 12, 2015
1 parent b9e5be6 commit ad333cd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ad333cd

Please sign in to comment.