| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -640,8 +640,9 @@ static void mi_option_init(mi_option_desc_t* desc) { | |||
| 640 | 640 | } | |
| 641 | 641 | else { | |
| 642 | 642 | char* end = buf; | |
| 643 | + errno = 0; | ||
| 643 | 644 | long value = strtol(buf, &end, 10); | |
| 644 | - if (mi_option_has_size_in_kib(desc->option)) { | ||
| 645 | + if (errno==0 && mi_option_has_size_in_kib(desc->option)) { | ||
| 645 | 646 | // this option is interpreted in KiB to prevent overflow of `long` for large allocations | |
| 646 | 647 | // (long is 32-bit on 64-bit windows, which allows for 4TiB max.) | |
| 647 | 648 | size_t size = (value < 0 ? 0 : (size_t)value); | |
@@ -656,7 +657,7 @@ static void mi_option_init(mi_option_desc_t* desc) { | |||
| 656 | 657 | if (overflow || size > (MI_MAX_ALLOC_SIZE / MI_KiB)) { size = (MI_MAX_ALLOC_SIZE / MI_KiB); } | |
| 657 | 658 | value = (size > LONG_MAX ? LONG_MAX : (long)size); | |
| 658 | 659 | } | |
| 659 | - if (*end == 0) { | ||
| 660 | + if (errno==0 && *end == 0) { | ||
| 660 | 661 | mi_option_set(desc->option, value); | |
| 661 | 662 | } | |
| 662 | 663 | else { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments