[PATCH v2 26/29] Set padding bytes to 0 in WriteToClient

Alan Coopersmith alan.coopersmith at oracle.com
Wed Jul 4 15:37:40 PDT 2012


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

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
Reviewed-by: Keith Packard <keithp at keithp.com>
---
 os/io.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/os/io.c b/os/io.c
index b67a5f3..8d0e5cc 100644
--- a/os/io.c
+++ b/os/io.c
@@ -815,7 +815,11 @@ 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;
+    if (padBytes) {
+        memset(oco->buf + oco->count, '\0', padBytes);
+        oco->count += padBytes;
+    }
     return count;
 }
 
-- 
1.7.9.2



More information about the xorg-devel mailing list