Fix off-by-one error in cplus name demangling.

This commit is contained in:
Michael Tiemann 1991-12-06 03:01:12 +00:00
parent 715cafcbde
commit 1cca172985
2 changed files with 8 additions and 1 deletions

View File

@ -1,3 +1,8 @@
Thu Dec 5 18:59:51 1991 Michael Tiemann (tiemann at cygnus.com)
* cplus-dem.c (cplus_demangle): Call `string_need' when
null-terminating a partially-computed string.
Thu Dec 5 18:19:43 1991 Fred Fish (fnf at cygnus.com)
* dwarfread.c (enum_type): Build a correct TYPE_NAME, add a

View File

@ -338,7 +338,8 @@ cplus_demangle (type, arg_mode)
p += 1;
while (*p != '\0' && !(*p == '_' && p[1] == '_'))
p++;
string_appendn (&decl, type, p - type);
string_appendn (&decl, type, p - type);
string_need (&decl, 1);
*(decl.p) = '\0';
munge_function_name (&decl, 1);
if (decl.b[0] == '_')
@ -358,6 +359,7 @@ cplus_demangle (type, arg_mode)
else
{
string_appendn (&decl, type, p - type);
string_need (&decl, 1);
*(decl.p) = '\0';
munge_function_name (&decl, arg_mode);
p += 2;