FYI: Java: make_local_function_alias buffer size

Bryce McKinlay mckinlay@redhat.com
Fri Aug 20 16:32:00 GMT 2004


Thomas Neumann pointed out that make_local_function_alias() had a buffer 
overrun - I didn't allocate space for the extra 'L' character when 
allocating the 'name' buffer. I'm checking in this patch as obvious.

Bryce

2004-08-19  Bryce McKinlay  <mckinlay@redhat.com>

    * class.c (make_local_function_alias): Allocate extra space for 'L'
    in name buffer. Reported by Thomas Neumann.

--- class.c     19 Aug 2004 03:09:45 -0000      1.204
+++ class.c     19 Aug 2004 14:30:07 -0000
@@ -1210,7 +1210,7 @@
 #ifdef ASM_OUTPUT_DEF
   tree alias;
   const char *method_name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME 
(method));
-  char *name = alloca (strlen (method_name) + 1);
+  char *name = alloca (strlen (method_name) + 2);
   char *buf = alloca (strlen (method_name) + 128);



More information about the Java-patches mailing list