Loading
bdevperf: avoid using of out of boundary indices
This patch corrects patch 17176, which doesn't corectly addresses issue found by Klocwork scan. Both indices, k and i, needs to be verified here, as both *filename and *out has limited size. As the 'k' index is incremented inside the loop, the loop entry condition for k index must be set to k < (BDEVPERF_CONFIG_MAX_FILENAME - 1) not to k < BDEVPERF_CONFIG_MAX_FILENAME, to avoid situation where i and k are both equal to BDEVPERF_CONFIG_MAX_FILENAME - 1, 'for' loop pass is therefore executed, and inside the loop k is incremented (so it is set to k=BDEVPERF_CONFIG_MAX_FILENAME) giving in result out of boundary index for *out table in line: out[k] = 0; Change-Id: Idf62c40f86f3aa4c8c6372bc74e94703925de47e Signed-off-by:Marcin Spiewak <marcin.spiewak@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/18135 Reviewed-by:
Jim Harris <james.r.harris@intel.com> Reviewed-by:
Ben Walker <benjamin.walker@intel.com> Tested-by:
SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot