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

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