Commit 09ccfd23 authored by WANG Cong's avatar WANG Cong Committed by David S. Miller

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

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>
parent 54499969
...@@ -419,6 +419,9 @@ static int pptp_bind(struct socket *sock, struct sockaddr *uservaddr, ...@@ -419,6 +419,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;
...@@ -440,6 +443,9 @@ static int pptp_connect(struct socket *sock, struct sockaddr *uservaddr, ...@@ -440,6 +443,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