summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.bin/talk/io.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/usr.bin/talk/io.c b/usr.bin/talk/io.c
index 00b2548..bcbf535 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 */
OpenPOWER on IntegriCloud