--- freem/src/expr.c 2025/03/09 19:14:24 1.5 +++ freem/src/expr.c 2025/03/22 03:05:19 1.6 @@ -1,5 +1,5 @@ /* - * $Id: expr.c,v 1.5 2025/03/09 19:14:24 snw Exp $ + * $Id: expr.c,v 1.6 2025/03/22 03:05:19 snw Exp $ * expression parser * * @@ -24,6 +24,9 @@ * along with FreeM. If not, see . * * $Log: expr.c,v $ + * Revision 1.6 2025/03/22 03:05:19 snw + * Comply with X11-96/13 portable length of names + * * Revision 1.5 2025/03/09 19:14:24 snw * First phase of REUSE compliance and header reformat * @@ -173,6 +176,15 @@ void expr (short extyp) volatile int ch = 0; short group; /* flag to scan grouped patterns */ + + int max_namlen = 255; + + if ((rtn_dialect () == D_MDS) || (rtn_dialect () == D_M5) || (rtn_dialect () == D_FREEM)) { + max_namlen = 255; + } + else { + max_namlen = 8; + } #ifdef DEBUG_NEWPTR int loop; @@ -201,10 +213,14 @@ void expr (short extyp) (((ch == '/' && varnam[i - 1] != '/') || (ch == '%' && varnam[i - 1] == '/')) && (varnam[1] == '.' || varnam[1] == '/'))))) || (f != '^') && (ch == '.')) { - - varnam[i++] = ch; - + if ((i + 1) <= max_namlen) { + varnam[i++] = ch; + } + else { + merr_raise (M56); + return; + } }