mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
vnc: fix use-after-free
When vnc_client_read() return value is -1
vs is not valid any more.
Fixes: d49b87f0d1
Reported-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20180420084820.3873-1-kraxel@redhat.com
This commit is contained in:
@@ -1539,13 +1539,14 @@ gboolean vnc_client_io(QIOChannel *ioc G_GNUC_UNUSED,
|
||||
VncState *vs = opaque;
|
||||
if (condition & G_IO_IN) {
|
||||
if (vnc_client_read(vs) < 0) {
|
||||
goto end;
|
||||
/* vs is free()ed here */
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
if (condition & G_IO_OUT) {
|
||||
vnc_client_write(vs);
|
||||
}
|
||||
end:
|
||||
|
||||
if (vs->disconnecting) {
|
||||
if (vs->ioc_tag != 0) {
|
||||
g_source_remove(vs->ioc_tag);
|
||||
|
||||
Reference in New Issue
Block a user