diff options
author | WANG Cong <xiyou.wangcong@gmail.com> | 2015-12-15 00:48:36 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-12-15 08:29:34 +0300 |
commit | 09ccfd238e5a0e670d8178cf50180ea81ae09ae1 (patch) | |
tree | b4c1c685f0a8c3761f912c12bbc6c8aeeee63fbf | |
parent | 54499969c94362d4bd28ff2999ffdf0b6f359586 (diff) | |
download | linux-09ccfd238e5a0e670d8178cf50180ea81ae09ae1.tar.xz |
pptp: verify sockaddr_len in pptp_bind() and pptp_connect()
Reported-by: Dmitry Vyukov <dvyukov@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ppp/pptp.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/ppp/pptp.c b/drivers/net/ppp/pptp.c index fc69e41d0950..597c53e0a2ec 100644 --- a/drivers/net/ppp/pptp.c +++ b/drivers/net/ppp/pptp.c @@ -419,6 +419,9 @@ static int pptp_bind(struct socket *sock, struct sockaddr *uservaddr, struct pptp_opt *opt = &po->proto.pptp; int error = 0; + if (sockaddr_len < sizeof(struct sockaddr_pppox)) + return -EINVAL; + lock_sock(sk); opt->src_addr = sp->sa_addr.pptp; @@ -440,6 +443,9 @@ static int pptp_connect(struct socket *sock, struct sockaddr *uservaddr, struct flowi4 fl4; int error = 0; + if (sockaddr_len < sizeof(struct sockaddr_pppox)) + return -EINVAL; + if (sp->sa_protocol != PX_PROTO_PPTP) return -EINVAL; |