summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxebd <xeb@mail.ru>2019-01-21 06:17:03 +0300
committerGitHub <noreply@github.com>2019-01-21 06:17:03 +0300
commitf5d5b536c381db907ac92878221a3790f2f15842 (patch)
tree03bd3339bd8429119253f81c0023e2b2c2a5105b
parent7988855f92dc585ac854f683785fb2f7cd8d326e (diff)
parent07aea946f43ad30c22675f12dcfcfd9feb2b3c57 (diff)
downloadaccel-ppp-f5d5b536c381db907ac92878221a3790f2f15842.tar.gz
accel-ppp-f5d5b536c381db907ac92878221a3790f2f15842.zip
Merge pull request #65 from themiron/sstp
sstp: fix proxy-protocol-v2 sanity checks
-rw-r--r--accel-pppd/ctrl/sstp/sstp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/accel-pppd/ctrl/sstp/sstp.c b/accel-pppd/ctrl/sstp/sstp.c
index 3b65103a..0e991bc0 100644
--- a/accel-pppd/ctrl/sstp/sstp.c
+++ b/accel-pppd/ctrl/sstp/sstp.c
@@ -667,7 +667,7 @@ static int proxy_parse_v2(struct buffer_t *buf, struct sockaddr_t *peer, struct
case PROXY2_PROXY:
switch (hdr->fam >> 4) {
case PROXY2_AF_INET:
- if (n < sizeof(hdr) + sizeof(hdr->ipv4_addr))
+ if (n < sizeof(*hdr) + sizeof(hdr->ipv4_addr))
goto error;
peer->len = addr->len = sizeof(addr->u.sin);
peer->u.sin.sin_family = addr->u.sin.sin_family = AF_INET;
@@ -677,7 +677,7 @@ static int proxy_parse_v2(struct buffer_t *buf, struct sockaddr_t *peer, struct
addr->u.sin.sin_port = hdr->ipv4_addr.dst_port;
break;
case PROXY2_AF_INET6:
- if (n < sizeof(hdr) + sizeof(hdr->ipv6_addr))
+ if (n < sizeof(*hdr) + sizeof(hdr->ipv6_addr))
goto error;
peer->len = addr->len = sizeof(addr->u.sin6);
peer->u.sin6.sin6_family = addr->u.sin6.sin6_family = AF_INET6;
@@ -687,7 +687,7 @@ static int proxy_parse_v2(struct buffer_t *buf, struct sockaddr_t *peer, struct
addr->u.sin6.sin6_port = hdr->ipv6_addr.dst_port;
break;
case PROXY2_AF_UNIX:
- if (n < sizeof(hdr) + sizeof(hdr->unix_addr))
+ if (n < sizeof(*hdr) + sizeof(hdr->unix_addr))
goto error;
peer->len = addr->len = sizeof(addr->u.sun);
peer->u.sun.sun_family = addr->u.sun.sun_family = AF_UNIX;