[U-Boot,1/1] efi_loader parameter checks EFI_FILE_PROTOCOL.SetInfo()
diff mbox series

Message ID 20190911170434.3272-1-xypron.glpk@gmx.de
State Accepted, archived
Delegated to: Heinrich Schuchardt
Headers show
Series
  • [U-Boot,1/1] efi_loader parameter checks EFI_FILE_PROTOCOL.SetInfo()
Related show

Commit Message

Heinrich Schuchardt Sept. 11, 2019, 5:04 p.m. UTC
We do not support volume label changes. No parameter checks are needed
here.

When the info for as file is changed the buffer must always contain a file
name.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 lib/efi_loader/efi_file.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

--
2.23.0

Patch
diff mbox series

diff --git a/lib/efi_loader/efi_file.c b/lib/efi_loader/efi_file.c
index b79dc5fd29..98edd9830c 100644
--- a/lib/efi_loader/efi_file.c
+++ b/lib/efi_loader/efi_file.c
@@ -695,7 +695,9 @@  static efi_status_t EFIAPI efi_file_setinfo(struct efi_file_handle *file,
 		char *new_file_name, *pos;
 		loff_t file_size;

-		if (buffer_size < sizeof(struct efi_file_info)) {
+		/* The buffer will always contain a file name. */
+		if (buffer_size < sizeof(struct efi_file_info) + 2 ||
+		    buffer_size < info->size) {
 			ret = EFI_BAD_BUFFER_SIZE;
 			goto out;
 		}
@@ -735,12 +737,8 @@  static efi_status_t EFIAPI efi_file_setinfo(struct efi_file_handle *file,
 		 * TODO: Support read only
 		 */
 		ret = EFI_SUCCESS;
-	} else if (!guidcmp(info_type, &efi_file_system_info_guid)) {
-		if (buffer_size < sizeof(struct efi_file_system_info)) {
-			ret = EFI_BAD_BUFFER_SIZE;
-			goto out;
-		}
 	} else {
+		/* TODO: We do not support changing the volume label */
 		ret = EFI_UNSUPPORTED;
 	}
 out: