[Spice-devel] [PATCH spice-server 3/3] main-channel: Prevent overflow reading messages from client
Frediano Ziglio
fziglio at redhat.com
Mon Feb 6 10:25:30 UTC 2017
Caller is supposed the function return a buffer able to store
size bytes.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
---
server/main-channel.c | 3 +++
1 file changed, 3 insertions(+)
This patch was developed and reviewed internally for security reasons.
diff --git a/server/main-channel.c b/server/main-channel.c
index 24dd448..1124506 100644
--- a/server/main-channel.c
+++ b/server/main-channel.c
@@ -258,6 +258,9 @@ static uint8_t *main_channel_alloc_msg_rcv_buf(RedChannelClient *rcc,
if (type == SPICE_MSGC_MAIN_AGENT_DATA) {
return reds_get_agent_data_buffer(red_channel_get_server(channel), mcc, size);
+ } else if (size > sizeof(main_chan->recv_buf)) {
+ /* message too large, caller will log a message and close the connection */
+ return NULL;
} else {
return main_chan->recv_buf;
}
--
2.9.3
More information about the Spice-devel
mailing list