efi_loader: check parameters EFI_FILE_PROTOCOL.GetInfo()
Check the parameters of EFI_FILE_PROTOCOL.GetInfo() to avoid possible NULL
dereference.
Check the buffer size for EFI_FILE_SYSTEM_INFO.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
diff --git a/lib/efi_loader/efi_file.c b/lib/efi_loader/efi_file.c
index 3a108c6..71582e5 100644
--- a/lib/efi_loader/efi_file.c
+++ b/lib/efi_loader/efi_file.c
@@ -596,6 +596,12 @@
EFI_ENTRY("%p, %pUl, %p, %p", file, info_type, buffer_size, buffer);
+ if (!file || !info_type || !buffer_size ||
+ (*buffer_size && !buffer)) {
+ ret = EFI_INVALID_PARAMETER;
+ goto error;
+ }
+
if (!guidcmp(info_type, &efi_file_info_guid)) {
struct efi_file_info *info = buffer;
char *filename = basename(fh);