warp-vpn

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

commit 29de791e9e2b2e58afec332578928e31590b69f1
parent 376b9d90d05fbf5a4fc54bd624c921bffc437665
Author: sin <sin@2f30.org>
Date:   Wed, 22 Mar 2017 14:12:59 +0000

Die if packet size is larger than the maximum packet size allowed

This should be an impossible condition.

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

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