diff options
-rw-r--r-- | SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommunicationLibUsb.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommunicationLibUsb.c b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommunicationLibUsb.c index 59189db0dc..3dd1e3a62c 100644 --- a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommunicationLibUsb.c +++ b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommunicationLibUsb.c @@ -285,7 +285,10 @@ UsbDebugPortIn ( }
*Length = (UINT8)(MmioRead32((UINTN)&DebugPortRegister->ControlStatus) & 0xF);
- ASSERT (*Length <= 8);
+ if (*Length > 8) {
+ return RETURN_DEVICE_ERROR;
+ }
+
for (Index = 0; Index < *Length; Index++) {
Buffer[Index] = DebugPortRegister->DataBuffer[Index];
}
@@ -643,7 +646,11 @@ InitializeUsbDebugHardware ( //
return Status;
}
- ASSERT (Length == sizeof(USB_DEBUG_PORT_DESCRIPTOR));
+
+ if (Length != sizeof(USB_DEBUG_PORT_DESCRIPTOR)) {
+ return RETURN_DEVICE_ERROR;
+ }
+
//
// set usb debug device address as 0x7F.
//
|