From: Daniel Lenski Date: Thu, 14 May 2020 21:41:19 +0000 (-0700) Subject: n != ppp.hlen for HDLC (will only work by coincidence if PPP header is uncompressed... X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=ce48e5544971f9a153279b47161996cb0be6c067;p=users%2Fdwmw2%2Fopenconnect.git n != ppp.hlen for HDLC (will only work by coincidence if PPP header is uncompressed/4 bytes) See https://gitlab.com/openconnect/openconnect/-/commit/c060e713f7aba546ccc3a1e729dd6e2e21e0e43b#note_342889873 Signed-off-by: Daniel Lenski --- diff --git a/ppp.c b/ppp.c index 0c840073..265506ce 100644 --- a/ppp.c +++ b/ppp.c @@ -1001,9 +1001,11 @@ int ppp_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable) proto == PPP_LCP ? ASYNCMAP_LCP : ppp->out_asyncmap); if (!this) return 1; /* XX */ - store_be32(this->data + n - 4, this->len - n); + + /* XX: header is simply the number of bytes on the wire (excluding itself) */ + store_be32(this->data - this->ppp.hlen - 4, this->len + this->ppp.hlen); + this->ppp.hlen += 4; free(vpninfo->current_ssl_pkt); - this->ppp.hlen = -n + 4; vpninfo->current_ssl_pkt = this; break; default: