Do not attempt ro read more than sizeof(buf) from stdin.

This commit is contained in:
Olivier Houchard 2004-05-10 15:52:16 +00:00
parent 3581cc66bb
commit 72d8d1c7f3

View File

@ -138,6 +138,8 @@ talk()
*/
int i;
ioctl(0, FIONREAD, (void *) &nb);
if (nb > sizeof buf)
nb = sizeof buf;
nb = read(STDIN_FILENO, buf, nb);
display(&my_win, buf, nb);
/* might lose data here because sockt is non-blocking */