diff options
| author | dannysmith <dannysmith@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-10-03 04:36:36 +0000 |
|---|---|---|
| committer | dannysmith <dannysmith@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-10-03 04:36:36 +0000 |
| commit | 797dd800dcdcbb1d0344bdd6d112d8b083972891 (patch) | |
| tree | 7ce9af268f8db33625b08a0abf2b0372606543b8 | |
| parent | 3aa6c4f18668ef06ec6d7e500d133f3e20dd94f3 (diff) | |
| download | ppe42-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.c | 12 |
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; } |

