summaryrefslogtreecommitdiffstats
path: root/server/reds.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2011-04-01 10:34:24 +0200
committerHans de Goede <hdegoede@redhat.com>2011-04-04 11:23:11 +0200
commitd5906664080b73338bd2766565a94330fd3fd5d2 (patch)
treeaddf160f71f37700084e3c47d6db7e2babd88099 /server/reds.c
parentc652dfa5e635342672a66b9f4c7cbbfb1820341c (diff)
downloadspice-d5906664080b73338bd2766565a94330fd3fd5d2.tar.gz
spice-d5906664080b73338bd2766565a94330fd3fd5d2.tar.xz
spice-d5906664080b73338bd2766565a94330fd3fd5d2.zip
server: break read_from_vdi_port loop if the guest gets disconnected
read_from_vdi_port calls dispatch_vdi_port data, which will disconnect the guest agent if it sends invalid data. It would then try to read more data from the disconnected guest agent resulting in a NULL ptr dereference, this patch fixes this.
Diffstat (limited to 'server/reds.c')
-rw-r--r--server/reds.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/server/reds.c b/server/reds.c
index ba159be7..c55f0d32 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -883,7 +883,7 @@ static int read_from_vdi_port(void)
}
sif = SPICE_CONTAINEROF(vdagent->base.sif, SpiceCharDeviceInterface, base);
- while (!quit_loop) {
+ while (!quit_loop && vdagent) {
switch (state->read_state) {
case VDI_PORT_READ_STATE_READ_HADER:
n = sif->read(vdagent, state->recive_pos, state->recive_len);