Spdk/examples/bdev
Krzysztof Karas 0c4c32a928 bdevperf: avoid writing outside "out" array boundary
Currently variables "i" and "k" in config_filename_next()
function may increase at the same speed. When repeating
"for" loop at line 1862 both "i" and "k" are being incremented:
 + i by the for loop,
 + k by the "out[k++]" instruction.
This means that there may be a case, where for loop ends with
"i < BDEVPERF_CONFIG_MAX_FILENAME" condition, as value of "i"
is equal to BDEVPERF_CONFIG_MAX_FILENAME, and at the same time
value of "k" is also equal to BDEVPERF_CONFIG_MAX_FILENAME,
because after writing to out[BDEVPERF_CONFIG_MAX_FILENAME - 1]
element, we increment it one last time.
This results in writing "0" value at line 1873 to memory outside
"out" array boundary.
To amend this problem, compare k against
BDEVPERF_CONFIG_MAX_FILENAME, insted of i.

Change-Id: Ia45778c1f267d2b9dcd676cd9b6c662d09f6f94e
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17176
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2023-05-09 17:58:11 +08:00
..
bdevperf bdevperf: avoid writing outside "out" array boundary 2023-05-09 17:58:11 +08:00
fio_plugin bdev_fio_plugin: Replace spdk_bdev_first/next_leaf() by spdk_for_each_bdev_leaf() 2023-01-31 10:30:52 +00:00
hello_world add Intel copyright notices (and/or SPDX lic) where missing 2022-11-10 08:28:53 +00:00
Makefile bdevperf: promote bdevperf from test to example application 2022-11-16 09:52:41 +00:00