summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordannysmith <dannysmith@138bc75d-0d04-0410-961f-82ee72b054a4>2008-10-03 04:36:36 +0000
committerdannysmith <dannysmith@138bc75d-0d04-0410-961f-82ee72b054a4>2008-10-03 04:36:36 +0000
commit797dd800dcdcbb1d0344bdd6d112d8b083972891 (patch)
tree7ce9af268f8db33625b08a0abf2b0372606543b8
parent3aa6c4f18668ef06ec6d7e500d133f3e20dd94f3 (diff)
downloadppe42-gcc-797dd800dcdcbb1d0344bdd6d112d8b083972891.tar.gz
ppe42-gcc-797dd800dcdcbb1d0344bdd6d112d8b083972891.zip
* config/i386/winnt.c (i386_pe_strip_name_encoding_full):
Add a null terminator to the stripped name. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140849 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/config/i386/winnt.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c
index 8ef79058a7d..f4356c8bb94 100644
--- a/gcc/config/i386/winnt.c
+++ b/gcc/config/i386/winnt.c
@@ -352,8 +352,16 @@ i386_pe_strip_name_encoding_full (const char *str)
/* Strip trailing "@n". */
p = strchr (name, '@');
if (p)
- return ggc_alloc_string (name, p - name);
-
+ {
+ /* We need to replace the suffix with a null terminator.
+ Do that before using ggc_alloc_string to allocate the
+ const char *. */
+ size_t len = p - name;
+ char *newname = XALLOCAVEC (char, len + 1);
+ memcpy (newname, name, len);
+ newname [len] = 0;
+ return ggc_alloc_string (newname, len);
+ }
return name;
}
OpenPOWER on IntegriCloud