mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Avoid integer overflow in sprintf(); fix #3439
This issue was reported by https://hackerone.com/aerodudrizzt
This commit is contained in:
@@ -116,8 +116,9 @@ mrb_fix2binstr(mrb_state *mrb, mrb_value x, int base)
|
||||
|
||||
#define CHECK(l) do {\
|
||||
/* int cr = ENC_CODERANGE(result);*/\
|
||||
while (blen + (l) >= bsiz) {\
|
||||
while ((l) >= bsiz - blen) {\
|
||||
bsiz*=2;\
|
||||
if (bsiz < 0) mrb_raise(mrb, E_ARGUMENT_ERROR, "too big specifier"); \
|
||||
}\
|
||||
mrb_str_resize(mrb, result, bsiz);\
|
||||
/* ENC_CODERANGE_SET(result, cr);*/\
|
||||
|
||||
Reference in New Issue
Block a user