aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2020-06-10 10:58:53 +0200
committerAldy Hernandez <aldyh@redhat.com>2020-06-10 10:58:53 +0200
commit4efacd5dbb089a747567bc22685e0e5ce2e29079 (patch)
tree06ed9a276e78eabd5103113c0c163e1febf8a27c /gcc
parent49fac7943862d7c2d1039d1ea0c2b724ed5e2367 (diff)
downloadgcc-4efacd5dbb089a747567bc22685e0e5ce2e29079.zip
gcc-4efacd5dbb089a747567bc22685e0e5ce2e29079.tar.gz
gcc-4efacd5dbb089a747567bc22685e0e5ce2e29079.tar.bz2
Fix off-by-one allocation bug in get_fresh_function_name.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/misc.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/misc.cc b/gcc/misc.cc
index 33604c7..417b44d 100644
--- a/gcc/misc.cc
+++ b/gcc/misc.cc
@@ -40,7 +40,7 @@ get_fresh_function_name ()
pretty_printer pp;
dump_generic_node (&pp, cfun->decl, 0, TDF_VOPS|TDF_MEMSYMS, false);
const char *str = pp_formatted_text (&pp);
- result = new char[strlen (str)];
+ result = new char[strlen (str) + 1];
return strcpy (result, str);
}
result = new char[sizeof("UNKNOWN") + 1];