fortran: Fix off-by-one in buffer sizes.

gcc/fortran/ChangeLog:

	* misc.c (gfc_typename): Fix off-by-one in buffer sizes.
This commit is contained in:
Steve Kargl 2021-03-27 15:02:16 -07:00 committed by Jerry DeLisle
parent 651684b462
commit 01685676a9

View File

@ -124,8 +124,10 @@ gfc_basic_typename (bt type)
const char *
gfc_typename (gfc_typespec *ts, bool for_hash)
{
static char buffer1[GFC_MAX_SYMBOL_LEN + 7]; /* 7 for "TYPE()" + '\0'. */
static char buffer2[GFC_MAX_SYMBOL_LEN + 7];
/* Need to add sufficient padding for "TYPE()" + '\0', "UNION()" + '\0',
or "CLASS()" + '\0'. */
static char buffer1[GFC_MAX_SYMBOL_LEN + 8];
static char buffer2[GFC_MAX_SYMBOL_LEN + 8];
static int flag = 0;
char *buffer;
gfc_typespec *ts1;