summaryrefslogtreecommitdiffstats
path: root/src/interface
diff options
context:
space:
mode:
Diffstat (limited to 'src/interface')
-rw-r--r--src/interface/efi/efi_usb.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/interface/efi/efi_usb.c b/src/interface/efi/efi_usb.c
index bac2d053a..a8c274a57 100644
--- a/src/interface/efi/efi_usb.c
+++ b/src/interface/efi/efi_usb.c
@@ -981,6 +981,12 @@ efi_usb_get_string_descriptor ( EFI_USB_IO_PROTOCOL *usbio, UINT16 language,
goto err_get_header;
}
len = header.len;
+ if ( len < sizeof ( header ) ) {
+ DBGC ( usbdev, "USBDEV %s underlength string %d:%d\n",
+ usbintf->name, language, index );
+ rc = -EINVAL;
+ goto err_len;
+ }
/* Allocate buffer */
if ( ( efirc = bs->AllocatePool ( EfiBootServicesData, len,
@@ -1014,6 +1020,7 @@ efi_usb_get_string_descriptor ( EFI_USB_IO_PROTOCOL *usbio, UINT16 language,
err_get_descriptor:
bs->FreePool ( buffer );
err_alloc:
+ err_len:
err_get_header:
bs->RestoreTPL ( saved_tpl );
return EFIRC ( rc );