This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix off-by-one error in get_file_function_name_long


This patch fixes an alloca() call in get_file_function_name_long(),
which wasn't accounting for the null terminator.  It fixes the
boostrap failure that Rainer mentioned here:

   http://gcc.gnu.org/ml/gcc/2003-07/msg02258.html

Tested on mips-sgi-irix6o32 and mipsisa64-elf, installed as obvious.

Richard


	* tree.c (get_file_function_name_long): Fix size of alloca() area.

Index: tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.c,v
retrieving revision 1.321
diff -u -d -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.321 tree.c
--- tree.c	24 Jul 2003 20:48:06 -0000	1.321
+++ tree.c	8 Aug 2003 15:12:57 -0000
@@ -4517,7 +4517,7 @@ get_file_function_name_long (const char 
 	file = input_filename;
 
       len = strlen (file);
-      q = alloca (9 * 2 + len);
+      q = alloca (9 * 2 + len + 1);
       memcpy (q, file, len + 1);
       clean_symbol_name (q);
 


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