SourceLevelDebugPkg/Usb3: Make sure data from HW can fit in buffer

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
This commit is contained in:
Ruiyu Ni 2018-08-02 15:48:52 +08:00
parent 7fb7259fc0
commit 4d2b506631
1 changed files with 7 additions and 0 deletions

View File

@ -556,6 +556,13 @@ XhcDataTransfer (
XhcExecTransfer (Handle, Urb, Timeout);
//
// Make sure the data received from HW can fit in the received buffer.
//
if (Urb->Completed > *DataLength) {
return EFI_DEVICE_ERROR;
}
*DataLength = Urb->Completed;
Status = EFI_TIMEOUT;