Blame SOURCES/Ensure-urb_create_iocompletion-uses-size_t-for-calcu.patch

1069f6
From b3a695e9f38a42f1ef0cade0d5e1fe60cf68864e Mon Sep 17 00:00:00 2001
1069f6
From: akallabeth <akallabeth@posteo.net>
1069f6
Date: Thu, 13 Oct 2022 08:36:26 +0200
1069f6
Subject: [PATCH] Ensure urb_create_iocompletion uses size_t for calculation
1069f6
1069f6
(cherry picked from commit de7e0f062ee53d00b4a966a43855a716e3478150)
1069f6
---
1069f6
 channels/urbdrc/client/data_transfer.c | 8 +++++++-
1069f6
 1 file changed, 7 insertions(+), 1 deletion(-)
1069f6
1069f6
diff --git a/channels/urbdrc/client/data_transfer.c b/channels/urbdrc/client/data_transfer.c
1069f6
index 80e84af48..8642c8506 100644
1069f6
--- a/channels/urbdrc/client/data_transfer.c
1069f6
+++ b/channels/urbdrc/client/data_transfer.c
1069f6
@@ -97,7 +97,13 @@ static wStream* urb_create_iocompletion(UINT32 InterfaceField, UINT32 MessageId,
1069f6
                                         UINT32 OutputBufferSize)
1069f6
 {
1069f6
 	const UINT32 InterfaceId = (STREAM_ID_PROXY << 30) | (InterfaceField & 0x3FFFFFFF);
1069f6
-	wStream* out = Stream_New(NULL, OutputBufferSize + 28);
1069f6
+
1069f6
+#if UINT32_MAX >= SIZE_MAX
1069f6
+	if (OutputBufferSize > UINT32_MAX - 28ull)
1069f6
+		return NULL;
1069f6
+#endif
1069f6
+
1069f6
+	wStream* out = Stream_New(NULL, OutputBufferSize + 28ull);
1069f6
 
1069f6
 	if (!out)
1069f6
 		return NULL;
1069f6
-- 
1069f6
2.37.1
1069f6