diff options
Diffstat (limited to 'xorg-server/os/io.c')
-rw-r--r-- | xorg-server/os/io.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/xorg-server/os/io.c b/xorg-server/os/io.c index 21d2cf75c..d2eb04649 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.
|