Spdk/examples
Krzysztof Karas 6d7b690584 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-04-12 16:44:42 +00:00
..
accel examples/accel/perf: add support for xor 2023-02-21 08:33:18 +00:00
bdev bdevperf: avoid writing outside "out" array boundary 2023-04-12 16:44:42 +00:00
blob add Intel copyright notices (and/or SPDX lic) where missing 2022-11-10 08:28:53 +00:00
idxd example/idxd_perf: Adjust the printing data spacing to make it beautiful 2023-01-16 15:19:54 +00:00
interrupt_tgt Add SPDX header to various files 2022-11-29 08:27:51 +00:00
ioat update Intel copyright notices 2022-11-10 08:28:53 +00:00
nvme nvmf: add copy command support in get log page 2023-03-27 11:25:35 +00:00
nvmf examples/nvmf: explicitly set the initial value for local variables 2022-12-13 09:26:18 +00:00
sock examples/sock: close the right sock object 2022-12-16 09:26:11 +00:00
util add Intel copyright notices (and/or SPDX lic) where missing 2022-11-10 08:28:53 +00:00
vmd examples/vmd: Add nvme library to VMD example apps 2022-12-05 09:35:14 +00:00
Makefile update Intel copyright notices 2022-11-10 08:28:53 +00:00