summaryrefslogtreecommitdiffstats
path: root/libvncclient/zrle.c
diff options
context:
space:
mode:
authordscho <dscho>2007-02-01 15:02:59 +0000
committerdscho <dscho>2007-02-01 15:02:59 +0000
commit35d481a783474d8b5eab4e9924008414253bbf4c (patch)
treec98ddcfbd4f967382b1781d38e50618b7ea3774d /libvncclient/zrle.c
parent819fe41bdc7758c0489af4f70afccac07b3ffd26 (diff)
downloadlibvncserver-35d481a783474d8b5eab4e9924008414253bbf4c.zip
libvncserver-35d481a783474d8b5eab4e9924008414253bbf4c.tar.gz
sometimes zrle sends too many bytes; play safe
Diffstat (limited to 'libvncclient/zrle.c')
-rw-r--r--libvncclient/zrle.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libvncclient/zrle.c b/libvncclient/zrle.c
index 701fb43..ac4aace 100644
--- a/libvncclient/zrle.c
+++ b/libvncclient/zrle.c
@@ -56,6 +56,7 @@ HandleZRLE (rfbClient* client, int rx, int ry, int rw, int rh)
int remaining;
int inflateResult;
int toRead;
+ int min_buffer_size = rw * rh * (REALBPP / 8) * 2;
/* First make sure we have a large enough raw buffer to hold the
* decompressed data. In practice, with a fixed REALBPP, fixed frame
@@ -63,7 +64,7 @@ HandleZRLE (rfbClient* client, int rx, int ry, int rw, int rh)
* buffer, this buffer allocation should only happen once, on the
* first update.
*/
- if ( client->raw_buffer_size < (( rw * rh ) * ( REALBPP / 8 ))) {
+ if ( client->raw_buffer_size < min_buffer_size) {
if ( client->raw_buffer != NULL ) {
@@ -71,7 +72,7 @@ HandleZRLE (rfbClient* client, int rx, int ry, int rw, int rh)
}
- client->raw_buffer_size = (( rw * rh ) * ( REALBPP / 8 ));
+ client->raw_buffer_size = min_buffer_size;
client->raw_buffer = (char*) malloc( client->raw_buffer_size );
}
OpenPOWER on IntegriCloud