about summary refs log tree commit diff
path: root/posix/execlp.c
diff options
context:
space:
mode:
Diffstat (limited to 'posix/execlp.c')
-rw-r--r--posix/execlp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/posix/execlp.c b/posix/execlp.c
index 6b9f211ed0..950705604c 100644
--- a/posix/execlp.c
+++ b/posix/execlp.c
@@ -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 *);