commit 964ca0d06f57cdebdacd8c942f98bf2b0f527578
parent 712eb2af65b9cfd2a6efa465e86dba1907141a1a
Author: sin <sin@2f30.org>
Date: Thu, 31 Mar 2016 16:51:42 +0100
use defines
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/stun.c b/stun.c
@@ -506,8 +506,8 @@ readnet(int fd, unsigned char *pt, int len)
CHECKERR(n);
payloadlen = unpack16(hdr);
- if (payloadlen > sizeof(payload))
- payloadlen = sizeof(payload);
+ if (payloadlen > MTU + AES_BLOCK_SIZE)
+ payloadlen = MTU + AES_BLOCK_SIZE;
n = readall(fd, payload, payloadlen);
CHECKERR(n);
@@ -593,7 +593,7 @@ tunnel(int netfd, int devfd)
logerr("bad fd in poll set");
if (pfd[0].revents & (POLLIN | POLLHUP)) {
- n = readnet(netfd, buf, sizeof(buf));
+ n = readnet(netfd, buf, MTU + AES_BLOCK_SIZE);
if (n <= 0)
return -1;
if (n == BADPKT) {