On 14/7/26 11:28 AM, Chen Gang wrote: > The related strncpy() for custom_builtin_name[*] may set 5 none-zero > characters, which may cause custom_builtin_name[*] is none-zero > terminated. > > So add additional '\0' byte for custom_builtin_name[*].
Where did you see this? Supposedly the snprintf of the custom function type string should at most be of 'xnxx' format; 4 characters at most, not 5. Do you have a test case where the behavior you described appears? Thanks, Chung-Lin > ChangeLog: > > * config/nios2/nios2.c (custom_builtin_name): Let it always be > zero terminated string. > > Signed-off-by: Chen Gang <gang.chen.5...@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) >