summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2013-03-11 16:28:47 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2013-03-11 16:28:47 +0100
commitaceae83203bf459a476ee64201c2e6a48143d9a3 (patch)
treef30341b3361399fc92afe74a2e50593f00c1d013
parenta8fbcc81022f917258dd066892d7917e335c98e2 (diff)
downloadecon-aceae83203bf459a476ee64201c2e6a48143d9a3.tar.gz
econ-aceae83203bf459a476ee64201c2e6a48143d9a3.tar.bz2
econ-aceae83203bf459a476ee64201c2e6a48143d9a3.zip
econproxy: Thight reader needs to pass a offset to loop_read
-rw-r--r--econproxy.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/econproxy.c b/econproxy.c
index cd8a4d0..c7919f9 100644
--- a/econproxy.c
+++ b/econproxy.c
@@ -474,6 +474,7 @@ rfb_retrieve_framebuffer_update(struct ep *ep,
for (i = 0; i < framebuffer_update->nrects; ++i) {
char *data;
size_t size;
+ off_t offset = 0;
ssize_t r;
struct rfb_frame *frame = malloc(sizeof *frame);
@@ -529,9 +530,9 @@ rfb_retrieve_framebuffer_update(struct ep *ep,
count = 3;
}
}
- size = (sizeof compression_control +
- count * sizeof(compact_len[0]) +
- len);
+ offset = (sizeof compression_control +
+ count * sizeof(compact_len[0]));
+ size = offset + len;
data = malloc(size);
if (data == NULL)
goto err;
@@ -553,8 +554,8 @@ rfb_retrieve_framebuffer_update(struct ep *ep,
iov[i*2+1].iov_len = size;
datasize += size;
- len = loop_read(ep->vnc_fd, data, size, 0);
- if (len < 0 || (size_t) len != size)
+ len = loop_read(ep->vnc_fd, &data[offset], size-offset, 0);
+ if (len < 0 || (size_t) len != (size-offset))
goto err;
}