XQuartz: Fix an array-index-out-of-bounds crasher

Found-by: GuardMalloc
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
This commit is contained in:
Jeremy Huddleston 2011-05-14 14:09:45 -07:00
parent 0e7f61d72c
commit fd5f630bc4

View File

@ -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) {