Fortran: Fix 'name' bound size [PR99688]

gcc/fortran/ChangeLog:

	PR fortran/99688
	* match.c (select_type_set_tmp, gfc_match_select_type,
	gfc_match_select_rank): Fix 'name' buffersize to avoid out of bounds.
	* resolve.c (resolve_select_type): Likewise.
This commit is contained in:
Tobias Burnus 2021-03-22 09:49:48 +01:00
parent fc9c4e5fc5
commit 0e792ee11a
2 changed files with 4 additions and 4 deletions

View File

@ -6330,7 +6330,7 @@ select_intrinsic_set_tmp (gfc_typespec *ts)
static void
select_type_set_tmp (gfc_typespec *ts)
{
char name[GFC_MAX_SYMBOL_LEN];
char name[GFC_MAX_SYMBOL_LEN + 12 + 1];
gfc_symtree *tmp = NULL;
gfc_symbol *selector = select_type_stack->selector;
gfc_symbol *sym;
@ -6409,7 +6409,7 @@ gfc_match_select_type (void)
{
gfc_expr *expr1, *expr2 = NULL;
match m;
char name[GFC_MAX_SYMBOL_LEN];
char name[GFC_MAX_SYMBOL_LEN + 1];
bool class_array;
gfc_symbol *sym;
gfc_namespace *ns = gfc_current_ns;
@ -6634,7 +6634,7 @@ gfc_match_select_rank (void)
{
gfc_expr *expr1, *expr2 = NULL;
match m;
char name[GFC_MAX_SYMBOL_LEN];
char name[GFC_MAX_SYMBOL_LEN + 1];
gfc_symbol *sym, *sym2;
gfc_namespace *ns = gfc_current_ns;
gfc_array_spec *as = NULL;

View File

@ -9246,7 +9246,7 @@ resolve_select_type (gfc_code *code, gfc_namespace *old_ns)
gfc_code *class_is = NULL, *default_case = NULL;
gfc_case *c;
gfc_symtree *st;
char name[GFC_MAX_SYMBOL_LEN];
char name[GFC_MAX_SYMBOL_LEN + 12 + 1];
gfc_namespace *ns;
int error = 0;
int rank = 0;