PATCH: Fix a memory bug in java

H . J . Lu hjl@lucon.org
Sat Jun 8 09:16:00 GMT 2002


Am I the only one affected by this? I will check it in as an obvious
fix for both mainline and 3.1 branch.


H.J.
---
2002-06-08  H.J. Lu  (hjl@gnu.org)

	* jcf-path.c (jcf_path_init): Allocate 1 more byte for string.

--- gcc/java/jcf-path.c.mem	Tue Apr 30 10:13:57 2002
+++ gcc/java/jcf-path.c	Sat Jun  8 09:12:44 2002
@@ -305,7 +305,7 @@ jcf_path_init ()
       /* Desperation: use the installed one.  */
       char *extdirs;
       add_entry (&sys_dirs, LIBGCJ_ZIP_FILE, 1);
-      extdirs = (char *) alloca (strlen (LIBGCJ_ZIP_FILE));
+      extdirs = (char *) alloca (strlen (LIBGCJ_ZIP_FILE) + 1);
       strcpy (extdirs, LIBGCJ_ZIP_FILE);
       strcpy (&extdirs[strlen (LIBGCJ_ZIP_FILE)
 		      - strlen ("libgcj-" DEFAULT_TARGET_VERSION ".jar")],



More information about the Gcc-patches mailing list