efi_loader: image_loader: fix a Coverity check against array access
authorAKASHI Takahiro <takahiro.akashi@linaro.org>
Fri, 8 May 2020 05:51:59 +0000 (14:51 +0900)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Sat, 9 May 2020 07:30:27 +0000 (09:30 +0200)
commit52d7bfe78787c93b95e805b44bb4d746a65edde4
tree2a3ade1d823a64b825af7663ede6b2eb1dab1c8f
parentc5c657644bc35fd6b3d6e5517698721e90646b8d
efi_loader: image_loader: fix a Coverity check against array access

Coverity detected:
  Using "&opt->CheckSum" as an array.  This might corrupt or misinterpret
  adjacent memory locations.

The code should work as far as a structure, IMAGE_OPTIONAL_HEADER(64) is
packed, but modify it in more logical form. Subsystem is a member next to
CheckSum.

Reported-by: Coverity (CID 300339)
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
lib/efi_loader/efi_image_loader.c