summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Grishenko <themiron@mail.ru>2019-01-19 03:38:30 +0500
committerVladislav Grishenko <themiron@mail.ru>2019-01-19 03:38:30 +0500
commit07aea946f43ad30c22675f12dcfcfd9feb2b3c57 (patch)
tree3e7109bfdaf35c584d5dd62440d7e683b9a45e9a
parent2910add2238d419ad82e43f3ebf1fb8d5708e13b (diff)
downloadaccel-ppp-07aea946f43ad30c22675f12dcfcfd9feb2b3c57.tar.gz
accel-ppp-07aea946f43ad30c22675f12dcfcfd9feb2b3c57.zip
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;