[Spice-devel] [PATCH 0.8 3/9] server: break read_from_vdi_port loop if the guest gets disconnected

Hans de Goede hdegoede at redhat.com
Fri Apr 1 08:13:03 PDT 2011


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.
---
 server/reds.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/server/reds.c b/server/reds.c
index b286809..088683b 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -1292,7 +1292,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);
-- 
1.7.4.2



More information about the Spice-devel mailing list