mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mruby-sprintf/sprintf.c: check integer overflow before casting.
This commit is contained in:
@@ -259,7 +259,7 @@ get_num(mrb_state *mrb, const char *p, const char *end, int *valp)
|
||||
{
|
||||
char *e;
|
||||
mrb_int n;
|
||||
if (!mrb_read_int(p, end, &e, &n)) {
|
||||
if (!mrb_read_int(p, end, &e, &n) || INT_MAX < n) {
|
||||
return NULL;
|
||||
}
|
||||
*valp = (int)n;
|
||||
|
||||
Reference in New Issue
Block a user