]> gcc.gnu.org Git - gcc.git/commitdiff
gcc.c (make_relative_prefix): Allocate a sufficiently large buffer.
authorMatt Kraai <kraai@alumni.carnegiemellon.edu>
Mon, 20 Aug 2001 13:39:36 +0000 (13:39 +0000)
committerMatt Kraai <kraai@gcc.gnu.org>
Mon, 20 Aug 2001 13:39:36 +0000 (13:39 +0000)
* gcc.c (make_relative_prefix): Allocate a sufficiently large
buffer.

From-SVN: r45049

gcc/ChangeLog
gcc/gcc.c

index 5a283f9f37a39a71e7f363eb15ae278751401f01..ac9cee0c258565ca92f65462c60e28ec3588354e 100644 (file)
@@ -1,3 +1,8 @@
+2001-08-20  Matt Kraai  <kraai@alumni.carnegiemellon.edu>
+
+       * gcc.c (make_relative_prefix): Allocate a sufficiently large
+       buffer.
+
 2001-08-20  Richard Henderson  <rth@redhat.com>
 
        * final.c (end_final): Fix typo last change.
index 47cfa2e95ff33f1d2c77042b2757b1ba71fff817..99a5c3cd59495ed34807d27806be3419d29d52b4 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -2285,8 +2285,12 @@ make_relative_prefix (progname, bin_prefix, prefix)
       GET_ENV_PATH_LIST (temp, "PATH");
       if (temp)
        {
-         char *startp, *endp;
-         char *nstore = (char *) alloca (strlen (temp) + strlen (progname) + 1);
+         char *startp, *endp, *nstore;
+         size_t prefixlen = strlen (temp) + 1;
+         if (prefixlen < 2)
+           prefixlen = 2;
+
+         nstore = (char *) alloca (prefixlen + strlen (progname) + 1);
 
          startp = endp = temp;
          while (1)
This page took 0.29455 seconds and 5 git commands to generate.