aboutsummaryrefslogtreecommitdiff
path: root/vnc.c
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-04-29 01:53:20 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-04-29 01:53:20 +0000
commitcf2d385c43b4387bec5a546c9b85ac654273cfa3 (patch)
tree91233233f392c3c1762dfc336ef4f2f51454e9a3 /vnc.c
parent2abec30bcf132b4f9e5911c4155e2a32a33665e9 (diff)
downloadqemu-cf2d385c43b4387bec5a546c9b85ac654273cfa3.zip
qemu-cf2d385c43b4387bec5a546c9b85ac654273cfa3.tar.gz
qemu-cf2d385c43b4387bec5a546c9b85ac654273cfa3.tar.bz2
Crop VNC update requests to avoid segfaults, by Thomas Tuttle.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2741 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'vnc.c')
-rw-r--r--vnc.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/vnc.c b/vnc.c
index aba60d4..70d30d9 100644
--- a/vnc.c
+++ b/vnc.c
@@ -852,6 +852,15 @@ static void framebuffer_update_request(VncState *vs, int incremental,
int x_position, int y_position,
int w, int h)
{
+ if (x_position > vs->ds->width)
+ x_position = vs->ds->width;
+ if (y_position > vs->ds->height)
+ y_position = vs->ds->height;
+ if (x_position + w >= vs->ds->width)
+ w = vs->ds->width - x_position;
+ if (y_position + h >= vs->ds->height)
+ h = vs->ds->height - y_position;
+
int i;
vs->need_update = 1;
if (!incremental) {