mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Fix integer overflow; fix #3473
The fix is suggested by https://hackerone.com/lucnguyen
This commit is contained in:
+1
-1
@@ -469,7 +469,7 @@ str_substr(mrb_state *mrb, mrb_value str, mrb_int beg, mrb_int len)
|
||||
beg += clen;
|
||||
if (beg < 0) return mrb_nil_value();
|
||||
}
|
||||
if (beg + len > clen)
|
||||
if (len > clen - beg)
|
||||
len = clen - beg;
|
||||
if (len <= 0) {
|
||||
len = 0;
|
||||
|
||||
Reference in New Issue
Block a user