Patchwork [15/16] vnc: add missing lock for vnc_cursor_define()

login
register
mail settings
Submitter Corentin Chary
Date June 16, 2010, 7:12 a.m.
Message ID <1276672333-14831-16-git-send-email-corentincj@iksaif.net>
Download mbox | patch
Permalink /patch/55851/
State New
Headers show

Comments

Corentin Chary - June 16, 2010, 7:12 a.m.
All vnc_write() calls must be locked (except the ones present before
the protocol initialization).

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
---
 ui/vnc.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Patch

diff --git a/ui/vnc.c b/ui/vnc.c
index cffe238..61f9a05 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -794,6 +794,7 @@  static int vnc_cursor_define(VncState *vs)
     int isize;
 
     if (vnc_has_feature(vs, VNC_FEATURE_RICH_CURSOR)) {
+        vnc_lock_output(vs);
         vnc_write_u8(vs,  VNC_MSG_SERVER_FRAMEBUFFER_UPDATE);
         vnc_write_u8(vs,  0);  /*  padding     */
         vnc_write_u16(vs, 1);  /*  # of rects  */
@@ -802,6 +803,7 @@  static int vnc_cursor_define(VncState *vs)
         isize = c->width * c->height * vs->clientds.pf.bytes_per_pixel;
         vnc_write_pixels_generic(vs, &pf, c->data, isize);
         vnc_write(vs, vs->vd->cursor_mask, vs->vd->cursor_msize);
+        vnc_unlock_output(vs);
         return 0;
     }
     return -1;