summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@apple.com>2011-05-14 14:11:13 -0700
committerJeremy Huddleston <jeremyhu@apple.com>2011-05-14 14:11:13 -0700
commit8e6cc68283518bba2820ff0d919aee9d49e3eb59 (patch)
tree876bb617bcc9e19b1fe9ad7b18359b0b43d62c33
parent3b53d7aecb2f3a729c57f2831a3d4b6e1ff1901f (diff)
launchd: Fix an array-index-out-of-bounds crasher
Found-by: GuardMalloc Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r--launchd/console_redirect.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/launchd/console_redirect.c b/launchd/console_redirect.c
index 26fa097..7ce3626 100644
--- a/launchd/console_redirect.c
+++ b/launchd/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) {