aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/os/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/os/io.c')
-rw-r--r--xorg-server/os/io.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/xorg-server/os/io.c b/xorg-server/os/io.c
index dc83d3a34..a26b394b9 100644
--- a/xorg-server/os/io.c
+++ b/xorg-server/os/io.c
@@ -410,16 +410,29 @@ ReadRequestFromClient(ClientPtr client)
else
needed = sizeof(xReq);
}
- oci->lenLastReq = needed;
/* If there are bytes to ignore, ignore them now. */
if (oci->ignoreBytes > 0) {
assert(needed == oci->ignoreBytes || needed == oci->size);
- oci->ignoreBytes -= gotnow;
- needed = gotnow = 0;
+ /*
+ * The _XSERVTransRead call above may return more or fewer bytes than we
+ * want to ignore. Ignore the smaller of the two sizes.
+ */
+ if (gotnow < needed) {
+ oci->ignoreBytes -= gotnow;
+ oci->bufptr += gotnow;
+ gotnow = 0;
+ } else {
+ oci->ignoreBytes -= needed;
+ oci->bufptr += needed;
+ gotnow -= needed;
+ }
+ needed = 0;
}
+ oci->lenLastReq = needed;
+
/*
* Check to see if client has at least one whole request in the
* buffer beyond the request we're returning to the caller.