mirror of https://github.com/acidanthera/audk.git
MdeModulePkg/UsbBus: Deny when the string descriptor length is odd
Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Star Zeng <star.zeng@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
This commit is contained in:
parent
6c46cbbd5e
commit
b2252bab12
|
@ -655,7 +655,13 @@ UsbGetOneString (
|
|||
//
|
||||
Status = UsbCtrlGetDesc (UsbDev, USB_DESC_TYPE_STRING, Index, LangId, &Desc, 2);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
// Reject if Length even cannot cover itself, or odd because Unicode string byte length should be even.
|
||||
//
|
||||
if (EFI_ERROR (Status) ||
|
||||
(Desc.Length < OFFSET_OF (EFI_USB_STRING_DESCRIPTOR, Length) + sizeof (Desc.Length)) ||
|
||||
(Desc.Length % 2 != 0)
|
||||
) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue