commit 7b677c29851dc9db9f4f4f18ecc44b64fbedaba4
parent 263820648b77b2cdbe04469ad6632f05655d8183
Author: sin <sin@2f30.org>
Date: Tue, 12 Apr 2016 14:52:22 +0100
attempt to discard the entire pkt
Diffstat:
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/netpkt.c b/netpkt.c
@@ -106,7 +106,6 @@ netread(int fd, unsigned char *pt, size_t ptlen, size_t *outlen)
if (rbufrem == 0) {
n = unpack16(&rbuf[noncelen]);
if (n > ptlen) {
- rbufrem = MAXPAYLOADLEN;
state = STATEDISCARD;
} else {
rbufrem = n;
@@ -161,7 +160,7 @@ netread(int fd, unsigned char *pt, size_t ptlen, size_t *outlen)
case STATEDISCARD:
state = STATEINITIAL;
for (;;) {
- n = read(fd, rbuf, rbufrem);
+ n = read(fd, rbuf, maxbuflen);
if (n == 0) {
return PKTFAILED;
} else if (n < 0) {