aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@cs.berkeley.edu>2015-09-27 15:22:36 -0700
committerAndrew Waterman <waterman@cs.berkeley.edu>2015-09-27 15:22:36 -0700
commit2fa6206d8fe658dfdec8a65e78a5d0e05d575950 (patch)
treef9c8076c52b1560ad459776c14364a8aab256b3f
parent3bfb39fe50e4eba22bafe737176016a1e2546580 (diff)
downloadriscv-gnu-toolchain-2fa6206d8fe658dfdec8a65e78a5d0e05d575950.zip
riscv-gnu-toolchain-2fa6206d8fe658dfdec8a65e78a5d0e05d575950.tar.gz
riscv-gnu-toolchain-2fa6206d8fe658dfdec8a65e78a5d0e05d575950.tar.bz2
gcc: obviate potential buffer overflow
-rw-r--r--gcc/gcc/config/riscv/riscv.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/gcc/config/riscv/riscv.c b/gcc/gcc/config/riscv/riscv.c
index 435ce0e..9248f15 100644
--- a/gcc/gcc/config/riscv/riscv.c
+++ b/gcc/gcc/config/riscv/riscv.c
@@ -2988,7 +2988,7 @@ riscv_elf_select_rtx_section (enum machine_mode mode, rtx x,
if (strncmp (s->named.name, ".rodata.cst", strlen (".rodata.cst")) == 0)
{
/* Rename .rodata.cst* to .srodata.cst*. */
- char name[32];
+ char *name = (char *) alloca (strlen (s->named.name) + 2);
sprintf (name, ".s%s", s->named.name + 1);
return get_section (name, s->named.common.flags, NULL);
}