From fd5f630bc41de73be3b1d26bf9ce3e9ef1badc3b Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Sat, 14 May 2011 14:09:45 -0700 Subject: [PATCH] XQuartz: Fix an array-index-out-of-bounds crasher Found-by: GuardMalloc Signed-off-by: Jeremy Huddleston --- hw/xquartz/console_redirect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) {