From 72d8d1c7f3928b386a2e64b75fcd03657658be24 Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Mon, 10 May 2004 15:52:16 +0000 Subject: [PATCH] Do not attempt ro read more than sizeof(buf) from stdin. --- usr.bin/talk/io.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usr.bin/talk/io.c b/usr.bin/talk/io.c index 00b2548f29c1..bcbf53580d06 100644 --- a/usr.bin/talk/io.c +++ b/usr.bin/talk/io.c @@ -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 */