Hi, Both the old (prior getting rid of TIOCSTI) and the new implementation of tenex() makes assumptions about the capacity of the input buffer without respect to the inputline_size parameter. A more correct handling would be to set `cl.size = MIN(BUFSIZ, inputline_size)` but since tenex() only has one call-site I would prefer getting rid of the parameter.
Comments? OK? Index: extern.h =================================================================== RCS file: /cvs/src/bin/csh/extern.h,v retrieving revision 1.25 diff -u -p -r1.25 extern.h --- extern.h 26 Dec 2015 13:48:38 -0000 1.25 +++ extern.h 29 Jun 2017 20:21:47 -0000 @@ -98,7 +98,7 @@ int exp0(Char ***, bool); /* * file.c */ -int tenex(Char *, int); +int tenex(Char *); /* * func.c Index: file.c =================================================================== RCS file: /cvs/src/bin/csh/file.c,v retrieving revision 1.30 diff -u -p -r1.30 file.c --- file.c 29 Jun 2017 04:23:12 -0000 1.30 +++ file.c 29 Jun 2017 20:21:47 -0000 @@ -745,7 +745,7 @@ is_suffix(Char *check, Char *template) } int -tenex(Char *inputline, int inputline_size) +tenex(Char *inputline) { static struct { int (*fn)(struct cmdline *, int); Index: lex.c =================================================================== RCS file: /cvs/src/bin/csh/lex.c,v retrieving revision 1.24 diff -u -p -r1.24 lex.c --- lex.c 23 Jan 2017 04:53:15 -0000 1.24 +++ lex.c 29 Jun 2017 20:21:48 -0000 @@ -1429,7 +1429,7 @@ again: roomleft = BUFSIZ - off; for (;;) { if (filec && intty) { - c = numleft ? numleft : tenex(ttyline, BUFSIZ); + c = numleft ? numleft : tenex(ttyline); if (c > roomleft) { /* start with fresh buffer */ feobp = fseekp = fblocks * BUFSIZ;