Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu...@intel.com> Cc: Hao A Wu <hao.a...@intel.com> Reviewed-by: Hao Wu <hao.a...@intel.com> --- .../DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Transfer.c | 7 +++++++ 1 file changed, 7 insertions(+)
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; -- 2.16.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel