diff mbox

gcc/config/nios2/nios2.c: Let custom_builtin_name[*] always be zero terminated string

Message ID 53D31FC4.1050601@sunrus.com.cn
State New
Headers show

Commit Message

Chen Gang July 26, 2014, 3:25 a.m. UTC
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 mbox

Patch

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)