MAINTAINERS: cthuang@io.org SUBJECT: Bug in cproto 4.4 (with patch) Fixes a memory bug in save_text_offset(): we don't know for sure that the destination of the strcpy() (yylval.text.text) has enough room to hold the contents of the source string (yytext). The patch simply checks to see whether there will be an overrun and exits if so; a better approach might be to make yylval.text.text a dynamically extensible string, but this looked like it would require much more work for little if any practical benefit. Still, it's probably the right thing to do. The patch also cures several infinite loops. Several loops calling input() continue until input() returns 0, assuming 0 (and only 0) would mean EOF. But on an unexpected EOF, input() will return the integer constant EOF, which is -1 on most platforms. The callers don't recognize this as meaning EOF, so they end up looping forever. The patch changes the tests to check that the returned character isn't EOF, either. (A slightly simpler change would loop while (c > 0) instead of while ((c != 0) && (c != EOF)), but this would fail if EOF is 257, which I believe is allowed by the ISO C standard -- since, with 8-bit chars, 257 is an int that is not representable by a char.)