diff --git a/src/ChangeLog b/src/ChangeLog index e4f53a22ee8f762e05bc42dc4f019aa47ef7b4e4..61711332b4c8c45a9cabed79964cac8981a5cae2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2004-01-27 Steven Tamm + + * unexmacosx.c (unexec_copy): Do not copy more than was + requested to prevent overwriting during unexec. + 2004-01-27 Jan Dj,Ad(Brv * process.c (sigchld_handler): Add comment about not calling malloc. diff --git a/src/unexmacosx.c b/src/unexmacosx.c index b85323259731b9822462f190f13135c2652b21d7..b41c586d2e03999e315dc4001babe87c1528333d 100644 --- a/src/unexmacosx.c +++ b/src/unexmacosx.c @@ -192,6 +192,7 @@ static int unexec_copy (off_t dest, off_t src, ssize_t count) { ssize_t bytes_read; + ssize_t bytes_to_read; char buf[UNEXEC_COPY_BUFSZ]; @@ -203,7 +204,8 @@ unexec_copy (off_t dest, off_t src, ssize_t count) while (count > 0) { - bytes_read = read (infd, buf, UNEXEC_COPY_BUFSZ); + bytes_to_read = count > UNEXEC_COPY_BUFSZ ? UNEXEC_COPY_BUFSZ : count; + bytes_read = read (infd, buf, bytes_to_read); if (bytes_read <= 0) return 0; if (write (outfd, buf, bytes_read) != bytes_read)