From 1cca172985962a849c34d4c676fe64ca7a27a772 Mon Sep 17 00:00:00 2001 From: Michael Tiemann Date: Fri, 6 Dec 1991 03:01:12 +0000 Subject: [PATCH] Fix off-by-one error in cplus name demangling. --- gdb/ChangeLog | 5 +++++ gdb/cplus-dem.c | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ea4e7ea..456117e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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 diff --git a/gdb/cplus-dem.c b/gdb/cplus-dem.c index b34732c..e58a955 100644 --- a/gdb/cplus-dem.c +++ b/gdb/cplus-dem.c @@ -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; -- 2.7.4