mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-08-08 08:26:35 +00:00
Handle flow control without crashing for agent
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@redhat.com> Acked-by: Uri Lublin <uril@redhat.com>
This commit is contained in:
parent
5d2fb6a897
commit
0c5eca97f1
@ -1120,6 +1120,11 @@ 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),
|
dev->priv->recv_from_client_buf = red_char_device_write_buffer_get(RED_CHAR_DEVICE(dev),
|
||||||
client,
|
client,
|
||||||
size + sizeof(VDIChunkHeader));
|
size + sizeof(VDIChunkHeader));
|
||||||
|
/* check if buffer was allocated, as flow control is enabled for
|
||||||
|
* this device this is a normal condition */
|
||||||
|
if (!dev->priv->recv_from_client_buf) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
dev->priv->recv_from_client_buf_pushed = FALSE;
|
dev->priv->recv_from_client_buf_pushed = FALSE;
|
||||||
return dev->priv->recv_from_client_buf->buf + sizeof(VDIChunkHeader);
|
return dev->priv->recv_from_client_buf->buf + sizeof(VDIChunkHeader);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user