diff options
author | Jens Axboe <axboe@kernel.dk> | 2023-09-02 07:35:49 -0600 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-09-02 07:35:49 -0600 |
commit | 904ee91c2831615a054a8dea9b164e96ae00abb3 (patch) | |
tree | 4db30b95277fb5738e65a8978e26c8745cb6c58a | |
parent | 4a0c766c69ddfe5231d65f2676e97333ba89ab2b (diff) | |
parent | 2e0a52594ed11e738d2402a3e22d05ec5597535a (diff) | |
download | fio-904ee91c2831615a054a8dea9b164e96ae00abb3.tar.gz |
Merge branch 'pcpp_parse_nr_fix' of https://github.com/PCPartPicker/fio
* 'pcpp_parse_nr_fix' of https://github.com/PCPartPicker/fio:
Add basic error checking to parsing nr from rw=randrw:<nr>, etc
-rw-r--r-- | options.c | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -596,9 +596,21 @@ static int str_rw_cb(void *data, const char *str) if (!nr) return 0; - if (td_random(td)) - o->ddir_seq_nr = atoi(nr); - else { + if (td_random(td)) { + long long val; + + if (str_to_decimal(nr, &val, 1, o, 0, 0)) { + log_err("fio: randrw postfix parsing failed\n"); + free(nr); + return 1; + } + if ((val <= 0) || (val > UINT_MAX)) { + log_err("fio: randrw postfix parsing out of range\n"); + free(nr); + return 1; + } + o->ddir_seq_nr = (unsigned int) val; + } else { long long val; if (str_to_decimal(nr, &val, 1, o, 0, 0)) { |