diff options
author | bluhm <> | 2017-10-24 17:49:35 +0000 |
---|---|---|
committer | bluhm <> | 2017-10-24 17:49:35 +0000 |
commit | 4b67b71dca9c7dea6f10d024c79279ea73b79cc2 (patch) | |
tree | e924a7b3737959111ad958adc00ccb7d6e3688d5 /src/usr.bin/nc/netcat.c | |
parent | 838a68bd3008e28bcae263d36c56ef8f4c19c9a9 (diff) | |
download | openbsd-4b67b71dca9c7dea6f10d024c79279ea73b79cc2.tar.gz openbsd-4b67b71dca9c7dea6f10d024c79279ea73b79cc2.tar.bz2 openbsd-4b67b71dca9c7dea6f10d024c79279ea73b79cc2.zip |
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 'src/usr.bin/nc/netcat.c')
-rw-r--r-- | src/usr.bin/nc/netcat.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/usr.bin/nc/netcat.c b/src/usr.bin/nc/netcat.c index ce55972a7c..f8bd8fa498 100644 --- a/src/usr.bin/nc/netcat.c +++ b/src/usr.bin/nc/netcat.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: netcat.c,v 1.187 2017/07/15 17:27:39 jsing Exp $ */ | 1 | /* $OpenBSD: netcat.c,v 1.188 2017/10/24 17:49:35 bluhm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> | 3 | * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> |
4 | * Copyright (c) 2015 Bob Beck. All rights reserved. | 4 | * Copyright (c) 2015 Bob Beck. All rights reserved. |
@@ -563,13 +563,12 @@ main(int argc, char *argv[]) | |||
563 | * initially to wait for a caller, then use | 563 | * initially to wait for a caller, then use |
564 | * the regular functions to talk to the caller. | 564 | * the regular functions to talk to the caller. |
565 | */ | 565 | */ |
566 | int rv, plen; | 566 | int rv; |
567 | char buf[16384]; | 567 | char buf[2048]; |
568 | struct sockaddr_storage z; | 568 | struct sockaddr_storage z; |
569 | 569 | ||
570 | len = sizeof(z); | 570 | len = sizeof(z); |
571 | plen = 2048; | 571 | rv = recvfrom(s, buf, sizeof(buf), MSG_PEEK, |
572 | rv = recvfrom(s, buf, plen, MSG_PEEK, | ||
573 | (struct sockaddr *)&z, &len); | 572 | (struct sockaddr *)&z, &len); |
574 | if (rv < 0) | 573 | if (rv < 0) |
575 | err(1, "recvfrom"); | 574 | err(1, "recvfrom"); |