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

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