[U-Boot] [PATCH v3 2/2] efi_loader: LoadImage() check source size

Heinrich Schuchardt xypron.glpk at gmx.de
Mon May 6 21:22:57 UTC 2019


If the size of the source buffer is 0, return EFI_LOAD_ERROR.
(UEFI SCT II 2017: 3.4.1 LoadImage() - 5.1.4.1.6)

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
v3
	put change into separate patch
---
 lib/efi_loader/efi_boottime.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index bf560c6234..bc70018946 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -1781,6 +1781,10 @@ efi_status_t EFIAPI efi_load_image(bool boot_policy,
 		if (ret != EFI_SUCCESS)
 			goto error;
 	} else {
+		if (!source_size) {
+			ret = EFI_LOAD_ERROR;
+			goto error;
+		}
 		dest_buffer = source_buffer;
 	}
 	/* split file_path which contains both the device and file parts */
--
2.20.1



More information about the U-Boot mailing list