to prevent overwriting during unexec.
+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\e,Ad\e(Brv <jan.h.d@swipnet.se>
* process.c (sigchld_handler): Add comment about not calling malloc.
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];
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)