[PATCH v2 3/4] server: Return error when hardware message is too large.

Rémi Bernon rbernon at codeweavers.com
Wed Jan 12 10:23:59 CST 2022


So that the client allocates a larger receive buffer when needed and not
trigger the assert below when setting the reply message data.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 server/queue.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/server/queue.c b/server/queue.c
index f7bc28f39e9..4f69a082b74 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -2145,6 +2145,14 @@ static int get_hardware_message( struct thread *thread, unsigned int hw_id, user
             clear_bits &= ~get_hardware_msg_bit( msg );
             continue;
         }
+
+        reply->total = msg->data_size;
+        if (msg->data_size > get_reply_max_size())
+        {
+            set_error( STATUS_BUFFER_OVERFLOW );
+            return 1;
+        }
+
         /* now we can return it */
         if (!msg->unique_id) msg->unique_id = get_unique_id();
         reply->type   = MSG_HARDWARE;
-- 
2.34.1




More information about the wine-devel mailing list