cfi_flash: Bound-check index before array access