Skip to content

Commit

Permalink
pptp: verify sockaddr_len in pptp_bind() and pptp_connect()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
congwang authored and davem330 committed Dec 15, 2015
1 parent 5449996 commit 09ccfd2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/net/ppp/pptp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down

0 comments on commit 09ccfd2

Please sign in to comment.