This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix off-by-one error in get_file_function_name_long
- From: Richard Sandiford <rsandifo at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: 08 Aug 2003 16:21:11 +0100
- Subject: 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);