summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@apple.com>2011-05-14 14:09:45 -0700
committerJeremy Huddleston <jeremyhu@apple.com>2011-05-14 19:15:26 -0700
commitfd5f630bc41de73be3b1d26bf9ce3e9ef1badc3b (patch)
treefc70dd91b0a6bb3f0277ffc41effd3aa4359d590
parent0e7f61d72c4a929319e57c9b5b777e9413c23051 (diff)
XQuartz: Fix an array-index-out-of-bounds crasher
Found-by: GuardMalloc Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r--hw/xquartz/console_redirect.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/xquartz/console_redirect.c b/hw/xquartz/console_redirect.c
index cdd2b8960..70a819e42 100644
--- a/hw/xquartz/console_redirect.c
+++ b/hw/xquartz/console_redirect.c
@@ -116,7 +116,7 @@ static inline int _read_redirect(int fd, int flush) {
*s='\0';
asl_log(aslr->asl, aslr->msg, aslr->level, "%s", p);
} else if(aslr->buf != p) {
- memmove(aslr->buf, p, BUF_SIZE);
+ memmove(aslr->buf, p, BUF_SIZE - (p - aslr->buf));
aslr->w = aslr->buf + (s - p);
break;
} else if(nbytes == BUF_SIZE - 1) {