[Spice-devel] [spice-server 2/3] reds: Avoid integer overflows handling monitor configuration

Christophe Fergeau cfergeau at redhat.com
Tue Jul 11 08:58:00 UTC 2017


From: Frediano Ziglio <fziglio at redhat.com>

Avoid VDAgentMessage::size integer overflows.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/reds.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/server/reds.c b/server/reds.c
index ec2b6f475..656f518ff 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -1131,6 +1131,9 @@ static void reds_on_main_agent_monitors_config(RedsState *reds,
         spice_debug("not enough data yet. %zd", cmc->offset);
         return;
     }
+    if (msg_header->size < sizeof(VDAgentMonitorsConfig)) {
+        goto overflow;
+    }
     monitors_config = (VDAgentMonitorsConfig *)(cmc->buffer + sizeof(*msg_header));
     spice_debug("monitors_config->num_of_monitors: %d", monitors_config->num_of_monitors);
     reds_client_monitors_config(reds, monitors_config);
-- 
2.13.0



More information about the Spice-devel mailing list