Blame SOURCES/Added-missing-length-check-in-urb_control_transfer.patch

083b3c
From 8c513f127549433c830575202d1551b0e9dd182d Mon Sep 17 00:00:00 2001
083b3c
From: akallabeth <akallabeth@posteo.net>
083b3c
Date: Thu, 13 Oct 2022 09:00:48 +0200
083b3c
Subject: [PATCH] Added missing length check in urb_control_transfer
083b3c
083b3c
(cherry picked from commit ce838e2477cb8173ea5e98f35ad55ff41ea5117d)
083b3c
---
083b3c
 channels/urbdrc/client/data_transfer.c | 4 ++++
083b3c
 1 file changed, 4 insertions(+)
083b3c
083b3c
diff --git a/channels/urbdrc/client/data_transfer.c b/channels/urbdrc/client/data_transfer.c
083b3c
index 9a44e6e09..bb2784055 100644
083b3c
--- a/channels/urbdrc/client/data_transfer.c
083b3c
+++ b/channels/urbdrc/client/data_transfer.c
083b3c
@@ -673,7 +673,11 @@ static UINT urb_control_transfer(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* callba
083b3c
 	buffer = Stream_Pointer(out);
083b3c
 
083b3c
 	if (transferDir == USBD_TRANSFER_DIRECTION_OUT)
083b3c
+	{
083b3c
+		if (!Stream_CheckAndLogRequiredLength(TAG, s, OutputBufferSize))
083b3c
+			return ERROR_INVALID_DATA;
083b3c
 		Stream_Copy(s, out, OutputBufferSize);
083b3c
+	}
083b3c
 
083b3c
 	/**  process TS_URB_CONTROL_TRANSFER */
083b3c
 	if (!pdev->control_transfer(pdev, RequestId, EndpointAddress, TransferFlags, bmRequestType,
083b3c
-- 
083b3c
2.37.1
083b3c