This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] gcc/config/nios2/nios2.c: Let custom_builtin_name[*] always be zero terminated string
- From: Chen Gang <gang dot chen at sunrus dot com dot cn>
- To: Jeff Law <law at redhat dot com>, cltang at codesourcery dot com, sandra at codesourcery dot com
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sat, 26 Jul 2014 11:25:56 +0800
- Subject: [PATCH] gcc/config/nios2/nios2.c: Let custom_builtin_name[*] always be zero terminated string
- Authentication-results: sourceware.org; auth=none
The related strncpy() for custom_builtin_name[*] may set 5 none-zero
characters, which cause custom_builtin_name[*] none-zero terminated.
But error() assumes custom_builtin_name[*] is always zero terminated.
So add additional '\0' byte for custom_builtin_name[*].
ChangeLog:
* config/nios2/nios2.c (custom_builtin_name): Let it always be
zero terminated string.
Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
gcc/config/nios2/nios2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/config/nios2/nios2.c b/gcc/config/nios2/nios2.c
index a4e60c6..e4e005b 100644
--- a/gcc/config/nios2/nios2.c
+++ b/gcc/config/nios2/nios2.c
@@ -2510,7 +2510,7 @@ nios2_expand_fpu_builtin (tree exp, unsigned int code, rtx target)
total of (3 + 1) * (1 + 3 + 9) == 52 custom builtin functions.
*/
#define NUM_CUSTOM_BUILTINS ((3 + 1) * (1 + 3 + 9))
-static char custom_builtin_name[NUM_CUSTOM_BUILTINS][5];
+static char custom_builtin_name[NUM_CUSTOM_BUILTINS][6];
static void
nios2_init_custom_builtins (int start_code)
--
1.9.2.459.g68773ac