Clear them out when needed instead of leaving whatever values were
present in previously sent messages.

Signed-off-by: Alan Coopersmith <[email protected]>
---
 os/io.c |   18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/os/io.c b/os/io.c
index b67a5f3..f71ef56 100644
--- a/os/io.c
+++ b/os/io.c
@@ -815,7 +815,23 @@ WriteToClient(ClientPtr who, int count, const void *__buf)
     NewOutputPending = TRUE;
     FD_SET(oc->fd, &OutputPending);
     memmove((char *) oco->buf + oco->count, buf, count);
-    oco->count += count + padBytes;
+    oco->count += count;
+    switch (padBytes) {
+    case 0:
+        /* no padding needed */
+        break;
+    case 3:
+        oco->buf[oco->count++] = 0;
+        /* FALLTHROUGH */
+    case 2:
+        oco->buf[oco->count++] = 0;
+        /* FALLTHROUGH */
+    case 1:
+        oco->buf[oco->count++] = 0;
+        break;
+    default:
+        BUG_WARN(padBytes > 3);
+    }
     return count;
 }
 
-- 
1.7.9.2

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to