Rémi Bernon : server: Return error when hardware message is too large.

Alexandre Julliard julliard at winehq.org
Wed Jan 12 15:57:48 CST 2022


Module: wine
Branch: master
Commit: 095204a9f3bab7a85a96f002ccf5754894502659
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=095204a9f3bab7a85a96f002ccf5754894502659

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Wed Jan 12 17:23:59 2022 +0100

server: Return error when hardware message is too large.

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>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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;




More information about the wine-cvs mailing list