* posix/execl.c: Fix last argument of memcpy. Reported by Brian

Sumner <bls@sgi.com>. 
* posix/execlp.c: Likewise.
This commit is contained in:
Andreas Schwab 2001-09-14 10:14:51 +00:00
parent 23382b36a7
commit 0f5660af02
2 changed files with 8 additions and 4 deletions

View File

@ -52,7 +52,8 @@ execl (const char *path, const char *arg, ...)
if ((char *) nptr + argv_max == (char *) argv)
{
/* Stack grows down. */
argv = (const char **) memcpy (nptr, argv, i);
argv = (const char **) memcpy (nptr, argv,
i * sizeof (const char *));
argv_max += i;
}
else
@ -64,7 +65,8 @@ execl (const char *path, const char *arg, ...)
else
#endif
/* We have a hole in the stack. */
argv = (const char **) memcpy (nptr, argv, i);
argv = (const char **) memcpy (nptr, argv,
i * sizeof (const char *));
}
argv[i] = va_arg (args, const char *);

View File

@ -49,7 +49,8 @@ execlp (const char *file, const char *arg, ...)
if ((char *) nptr + argv_max == (char *) argv)
{
/* Stack grows down. */
argv = (const char **) memcpy (nptr, argv, i);
argv = (const char **) memcpy (nptr, argv,
i * sizeof (const char *));
argv_max += i;
}
else
@ -61,7 +62,8 @@ execlp (const char *file, const char *arg, ...)
else
#endif
/* We have a hole in the stack. */
argv = (const char **) memcpy (nptr, argv, i);
argv = (const char **) memcpy (nptr, argv,
i * sizeof (const char *));
}
argv[i] = va_arg (args, const char *);