[PATCH] Handle flow control without crashing for agent

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



RedCharDevice used for the agent has flow control enabled.
This make possible for red_char_device_write_buffer_get to return NULL.
Handle such situation without crashing avoiding NULL dereference.

This fixes https://bugs.freedesktop.org/show_bug.cgi?id=95416.

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

diff --git a/server/reds.c b/server/reds.c
index e4d806c..72dee84 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -1120,6 +1120,9 @@ uint8_t *reds_get_agent_data_buffer(RedsState *reds, MainChannelClient *mcc, siz
     dev->priv->recv_from_client_buf = red_char_device_write_buffer_get(RED_CHAR_DEVICE(dev),
                                                                        client,
                                                                        size + sizeof(VDIChunkHeader));
+    if (!dev->priv->recv_from_client_buf) {
+        return NULL;
+    }
     dev->priv->recv_from_client_buf_pushed = FALSE;
     return dev->priv->recv_from_client_buf->buf + sizeof(VDIChunkHeader);
 }
-- 
2.7.4

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]