aboutsummaryrefslogtreecommitdiff
path: root/posix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-08-23 22:20:34 +0000
committerUlrich Drepper <drepper@redhat.com>1999-08-23 22:20:34 +0000
commit69c0500a4f79de272fa1611f1f291de863e34cf6 (patch)
tree96e5be8ed932b130e10e677dd93ded00789a1b8d /posix
parenta41301f0383709a65a5d18659b47120487ce5fcf (diff)
downloadglibc-69c0500a4f79de272fa1611f1f291de863e34cf6.tar
glibc-69c0500a4f79de272fa1611f1f291de863e34cf6.tar.gz
glibc-69c0500a4f79de272fa1611f1f291de863e34cf6.tar.bz2
glibc-69c0500a4f79de272fa1611f1f291de863e34cf6.zip
(execvp): Correct copying of file name.
Diffstat (limited to 'posix')
-rw-r--r--posix/execvp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/posix/execvp.c b/posix/execvp.c
index 27568294a5..963b769fca 100644
--- a/posix/execvp.c
+++ b/posix/execvp.c
@@ -79,6 +79,7 @@ execvp (file, argv)
int got_eacces = 0;
char *path, *p, *name;
size_t len;
+ size_t pathlen;
path = getenv ("PATH");
if (path == NULL)
@@ -93,9 +94,10 @@ execvp (file, argv)
}
len = strlen (file) + 1;
- name = __alloca (strlen (path) + len + 1);
+ pathlen = strlen (path);
+ name = __alloca (pathlen + len + 1);
/* Copy the file name at the top. */
- name = (char *) memcpy (name - len, file, len);
+ name = (char *) memcpy (name + pathlen + 1, file, len);
/* And add the slash. */
*--name = '/';