Commit 911c78b4 authored by Steven Tamm's avatar Steven Tamm

unexecmacos.x (unexec_copy): Do not copy more than was requested (count)

to prevent overwriting during unexec.
parent 92c7831b
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.
......
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment