summaryrefslogtreecommitdiff
path: root/usr.bin/nc/netcat.c
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2017-10-24 17:49:36 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2017-10-24 17:49:36 +0000
commit2d105063164eccaa16f08eb686acf0152ec3f710 (patch)
tree65d524e80677316475efa91527122ad3bf3e9efc /usr.bin/nc/netcat.c
parentf2f07b61011a2bc77e821efe33cace7e4532dde5 (diff)
Use a smaller buffer size too peek the receive data. The content
is discarded anyway, the plen variable is a leftover from the -j jumbo option. reported by Nan Xiao; OK deraadt@
Diffstat (limited to 'usr.bin/nc/netcat.c')
-rw-r--r--usr.bin/nc/netcat.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/usr.bin/nc/netcat.c b/usr.bin/nc/netcat.c
index ce55972a7c2..f8bd8fa4988 100644
--- a/usr.bin/nc/netcat.c
+++ b/usr.bin/nc/netcat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: netcat.c,v 1.187 2017/07/15 17:27:39 jsing Exp $ */
+/* $OpenBSD: netcat.c,v 1.188 2017/10/24 17:49:35 bluhm Exp $ */
/*
* Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
* Copyright (c) 2015 Bob Beck. All rights reserved.
@@ -563,13 +563,12 @@ main(int argc, char *argv[])
* initially to wait for a caller, then use
* the regular functions to talk to the caller.
*/
- int rv, plen;
- char buf[16384];
+ int rv;
+ char buf[2048];
struct sockaddr_storage z;
len = sizeof(z);
- plen = 2048;
- rv = recvfrom(s, buf, plen, MSG_PEEK,
+ rv = recvfrom(s, buf, sizeof(buf), MSG_PEEK,
(struct sockaddr *)&z, &len);
if (rv < 0)
err(1, "recvfrom");