summaryrefslogtreecommitdiff
path: root/usr.bin/talk
diff options
context:
space:
mode:
authorOlivier Houchard <cognet@FreeBSD.org>2004-05-10 15:52:16 +0000
committerOlivier Houchard <cognet@FreeBSD.org>2004-05-10 15:52:16 +0000
commit72d8d1c7f3928b386a2e64b75fcd03657658be24 (patch)
tree6c558c8cc18204da4d47fe606af122b29e29e87f /usr.bin/talk
parent3581cc66bbd6129e945fd3ba12dcebb6e95842c4 (diff)
downloadsrc-test-72d8d1c7f3928b386a2e64b75fcd03657658be24.tar.gz
src-test-72d8d1c7f3928b386a2e64b75fcd03657658be24.zip
Do not attempt ro read more than sizeof(buf) from stdin.
Notes
Notes: svn path=/head/; revision=129090
Diffstat (limited to 'usr.bin/talk')
-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 00b2548f29c10..bcbf53580d06f 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 */