From: Steve Kargl Date: Sat, 27 Mar 2021 22:02:16 +0000 (-0700) Subject: fortran: Fix off-by-one in buffer sizes. X-Git-Tag: upstream/12.2.0~9081 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=01685676a9309bc0b8b2f4697c23bd6aa0e00d5d;p=platform%2Fupstream%2Fgcc.git fortran: Fix off-by-one in buffer sizes. gcc/fortran/ChangeLog: * misc.c (gfc_typename): Fix off-by-one in buffer sizes. --- diff --git a/gcc/fortran/misc.c b/gcc/fortran/misc.c index 8a96243..3d449ae1 100644 --- a/gcc/fortran/misc.c +++ b/gcc/fortran/misc.c @@ -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;