Skip to content
Commit 5701ba82 authored by Mario Six's avatar Mario Six Committed by Stefan Roese
Browse files

cfi_flash: Bound-check index before array access



In a while loop in cfi_flash.c the array "start" is accessed at the index
"sector" before the index variable "sector" is bounds-checked, which
might lead to accesses beyond the bounds of the array.

Swap the order of the checks in the "&&" expression, so that the
short-circuit evaluation prevents out-of-bounds array accesses.

Signed-off-by: default avatarMario Six <mario.six@gdsys.cc>
Signed-off-by: default avatarStefan Roese <sr@denx.de>
parent 9dbaebcf
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment