Commit aea955a2 by Scott Snyder Committed by Jeff Law

* method.c (make_thunk): Avoid name buffer overflow.

From-SVN: r17784
parent 13309a5f
Sun Feb 8 23:47:38 1998 scott snyder <sss@d0linux01.fnal.gov>
* method.c (make_thunk): Avoid name buffer overflow.
Sat Feb 7 16:48:54 1998 Jason Merrill <jason@yorick.cygnus.com> Sat Feb 7 16:48:54 1998 Jason Merrill <jason@yorick.cygnus.com>
* pt.c (instantiate_decl): Call cp_finish_decl for vars even if we * pt.c (instantiate_decl): Call cp_finish_decl for vars even if we
......
...@@ -1905,7 +1905,7 @@ make_thunk (function, delta) ...@@ -1905,7 +1905,7 @@ make_thunk (function, delta)
tree function; tree function;
int delta; int delta;
{ {
char buffer[250]; char *buffer;
tree thunk_id; tree thunk_id;
tree thunk; tree thunk;
char *func_name; char *func_name;
...@@ -1916,6 +1916,7 @@ make_thunk (function, delta) ...@@ -1916,6 +1916,7 @@ make_thunk (function, delta)
if (TREE_CODE (func_decl) != FUNCTION_DECL) if (TREE_CODE (func_decl) != FUNCTION_DECL)
abort (); abort ();
func_name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (func_decl)); func_name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (func_decl));
buffer = (char *)alloca (strlen (func_name) + 32);
if (delta<=0) if (delta<=0)
sprintf (buffer, "__thunk_%d_%s", -delta, func_name); sprintf (buffer, "__thunk_%d_%s", -delta, func_name);
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment