This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

execl/execlp bugs


I have checked in this patch:

2001-09-14  Andreas Schwab  <schwab@suse.de>

	* posix/execl.c: Fix last argument of memcpy.  Reported by Brian
	Sumner <bls@sgi.com>.
	* posix/execlp.c: Likewise.

--- posix/execl.c.~1.9.~	Mon Jul 16 10:43:42 2001
+++ posix/execl.c	Fri Sep 14 12:05:43 2001
@@ -52,7 +52,8 @@
 	  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 @@
 	  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 *);
--- posix/execlp.c.~1.9.~	Mon Jul 16 10:43:42 2001
+++ posix/execlp.c	Fri Sep 14 12:06:11 2001
@@ -49,7 +49,8 @@
 	  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 @@
 	  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 *);

-- 
Andreas Schwab                                  "And now for something
Andreas.Schwab@suse.de				completely different."
SuSE Labs, SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]