warp-vpn

point to point VPN implementation
git clone git://git.2f30.org/warp-vpn
Log | Files | Refs | README

commit c1abd8c852684b34530c53c8dd2d00fc720e2645
parent 50cd2f876290b87e0b22246bfac89b7460f0b3da
Author: sin <sin@2f30.org>
Date:   Sat, 30 Apr 2016 16:22:43 +0100

Print an error message if packet is too large

Diffstat:
Mnetpkt.c | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/netpkt.c b/netpkt.c @@ -48,8 +48,10 @@ netwrite(int fd, unsigned char *pt, size_t ptlen, size_t *outlen) size_t buflen = noncelen + HDRLEN + ptlen + taglen; int n, total = 0; - if (buflen > maxbuflen) + if (buflen > maxbuflen) { + logerr("packet is too large"); return PKTFAILED; + } arc4random_buf(wbuf, noncelen); pack16(&wbuf[noncelen], ptlen); @@ -83,8 +85,10 @@ netread(int fd, unsigned char *pt, size_t ptlen, size_t *outlen) size_t buflen = noncelen + HDRLEN + ptlen + taglen; int n, ctlen; - if (buflen > maxbuflen) + if (buflen > maxbuflen) { + logerr("packet is too large"); return PKTFAILED; + } for (;;) { switch (state) {