diff options
author | Steven Tamm <steventamm@mac.com> | 2004-01-28 06:07:36 +0000 |
---|---|---|
committer | Steven Tamm <steventamm@mac.com> | 2004-01-28 06:07:36 +0000 |
commit | 911c78b4aa114f17cc5388def3a026bb81c7e6a1 (patch) | |
tree | 0c5fd9d53f7fe0dcefa3e51b4ea7476f745e06fc /src | |
parent | 92c7831bff66ec6f4cc6be6687ab1bf0b00033d2 (diff) | |
download | emacs-911c78b4aa114f17cc5388def3a026bb81c7e6a1.tar.gz emacs-911c78b4aa114f17cc5388def3a026bb81c7e6a1.tar.bz2 emacs-911c78b4aa114f17cc5388def3a026bb81c7e6a1.zip |
unexecmacos.x (unexec_copy): Do not copy more than was requested (count)
to prevent overwriting during unexec.
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 5 | ||||
-rw-r--r-- | src/unexmacosx.c | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index e4f53a22ee8..61711332b4c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2004-01-27 Steven Tamm <steventamm@mac.com> + + * unexmacosx.c (unexec_copy): Do not copy more than was + requested to prevent overwriting during unexec. + 2004-01-27 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> * process.c (sigchld_handler): Add comment about not calling malloc. diff --git a/src/unexmacosx.c b/src/unexmacosx.c index b8532325973..b41c586d2e0 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) |