Commit 9f28d7c2 authored by WANG Cong's avatar WANG Cong Committed by Kamal Mostafa

pptp: verify sockaddr_len in pptp_bind() and pptp_connect()

[ Upstream commit 09ccfd23 ]
Reported-by: default avatarDmitry Vyukov <dvyukov@gmail.com>
Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent 28c01dc4
...@@ -418,6 +418,9 @@ static int pptp_bind(struct socket *sock, struct sockaddr *uservaddr, ...@@ -418,6 +418,9 @@ static int pptp_bind(struct socket *sock, struct sockaddr *uservaddr,
struct pptp_opt *opt = &po->proto.pptp; struct pptp_opt *opt = &po->proto.pptp;
int error = 0; int error = 0;
if (sockaddr_len < sizeof(struct sockaddr_pppox))
return -EINVAL;
lock_sock(sk); lock_sock(sk);
opt->src_addr = sp->sa_addr.pptp; opt->src_addr = sp->sa_addr.pptp;
...@@ -439,6 +442,9 @@ static int pptp_connect(struct socket *sock, struct sockaddr *uservaddr, ...@@ -439,6 +442,9 @@ static int pptp_connect(struct socket *sock, struct sockaddr *uservaddr,
struct flowi4 fl4; struct flowi4 fl4;
int error = 0; int error = 0;
if (sockaddr_len < sizeof(struct sockaddr_pppox))
return -EINVAL;
if (sp->sa_protocol != PX_PROTO_PPTP) if (sp->sa_protocol != PX_PROTO_PPTP)
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment