summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Grishenko <themiron@mail.ru>2026-07-26 13:19:07 +0500
committerVladislav Grishenko <themiron@mail.ru>2026-07-26 13:19:24 +0500
commitfd2cd2bce6328264ce9cb9bc371d7349319724a8 (patch)
tree047a1d763ed707c302c186096ce5b0cdb2a9a366
parent93c6a21673f693640ec8004b063a3471f784f8fa (diff)
downloadaccel-ppp-sstp-alloc-invariant.tar.gz
accel-ppp-sstp-alloc-invariant.zip
sstp: express escape buffer bound as one invariantsstp-alloc-invariant
(size + PPP_FCSLEN) * 2 + 2 equals 8b781b94's size*2 + 2 + PPP_FCSLEN*2 but can't collapse back to the 1801847a under-allocating form.
-rw-r--r--accel-pppd/ctrl/sstp/sstp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/accel-pppd/ctrl/sstp/sstp.c b/accel-pppd/ctrl/sstp/sstp.c
index 6c2b9ca9..1ab08a14 100644
--- a/accel-pppd/ctrl/sstp/sstp.c
+++ b/accel-pppd/ctrl/sstp/sstp.c
@@ -1846,7 +1846,8 @@ static int sstp_recv_data_packet(struct sstp_conn_t *conn, struct sstp_hdr *hdr)
buf_put_data(buf, hdr->data, size);
#else
- buf = alloc_buf(size*2 + 2 + PPP_FCSLEN*2);
+ /* payload and FCS octets may both double when escaped, plus 2 flags */
+ buf = alloc_buf((size + PPP_FCSLEN) * 2 + 2);
if (!buf) {
log_error("sstp: no memory\n");
return -1;