summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2012-07-09 19:12:44 -0700
committerJeremy Huddleston Sequoia <jeremyhu@apple.com>2012-08-01 17:59:40 -0700
commitf29c0ddd5afc4549e20d72a1d9e4c17276bb4bb1 (patch)
tree08818505dbabb187e4719d1853b197d84a748f02
parenteeefadf95ed764755bfb04b107f636c6ae60bdde (diff)
Set padding bytes to 0 in WriteToClient
Clear them out when needed instead of leaving whatever values were present in previously sent messages. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com> Tested-by: Daniel Stone <daniel@fooishbar.org> (cherry picked from commit bed610fcae41ddfe21fa9acde599b17d1d15f5d1)
-rw-r--r--os/io.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/os/io.c b/os/io.c
index b67a5f324..8d0e5cc6f 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;
}