diff options
author | Ruiyu Ni <ruiyu.ni@intel.com> | 2018-08-02 15:48:52 +0800 |
---|---|---|
committer | Ruiyu Ni <ruiyu.ni@intel.com> | 2018-10-17 11:03:59 +0800 |
commit | 4d2b5066317d3e16dc8041a3e62d3bfe1c90bb02 (patch) | |
tree | 683424fa72262214e7da58f7d8b00f3a71391dfa /SourceLevelDebugPkg | |
parent | 7fb7259fc0ef9dc25fc17f437658562f0d6f9595 (diff) | |
download | edk2-4d2b5066317d3e16dc8041a3e62d3bfe1c90bb02.tar.gz edk2-4d2b5066317d3e16dc8041a3e62d3bfe1c90bb02.tar.bz2 edk2-4d2b5066317d3e16dc8041a3e62d3bfe1c90bb02.zip |
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>
Diffstat (limited to 'SourceLevelDebugPkg')
-rw-r--r-- | SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Transfer.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Transfer.c b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Transfer.c index fb48010a9a..fda43279a3 100644 --- a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Transfer.c +++ b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Transfer.c @@ -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;
|