netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: Lance Richardson <lrichard@redhat.com>
Cc: netdev@vger.kernel.org, linux-sctp@vger.kernel.org,
	Xin Long <lucien.xin@gmail.com>
Subject: Re: [PATCH net] sctp: fix overrun in sctp_diag_dump_one()
Date: Tue, 23 Aug 2016 14:30:49 -0300	[thread overview]
Message-ID: <20160823173049.GA11144@localhost.localdomain> (raw)
In-Reply-To: <1471966852-6218-1-git-send-email-lrichard@redhat.com>

On Tue, Aug 23, 2016 at 11:40:52AM -0400, Lance Richardson wrote:
> The function sctp_diag_dump_one() currently performs a memcpy()
> of 64 bytes from a 16 byte field into another 16 byte field. Fix
> by using correct size, use sizeof to obtain correct size instead
> of using a hard-coded constant.
> 
> Fixes: 8f840e47f190 ("sctp: add the sctp_diag.c file")
> Signed-off-by: Lance Richardson <lrichard@redhat.com>

Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>

Dave, please consider it to -stable.
Thanks!

> ---
>  net/sctp/sctp_diag.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/net/sctp/sctp_diag.c b/net/sctp/sctp_diag.c
> index bb69153..f3508aa 100644
> --- a/net/sctp/sctp_diag.c
> +++ b/net/sctp/sctp_diag.c
> @@ -424,11 +424,13 @@ static int sctp_diag_dump_one(struct sk_buff *in_skb,
>  		paddr.v4.sin_family = AF_INET;
>  	} else {
>  		laddr.v6.sin6_port = req->id.idiag_sport;
> -		memcpy(&laddr.v6.sin6_addr, req->id.idiag_src, 64);
> +		memcpy(&laddr.v6.sin6_addr, req->id.idiag_src,
> +		       sizeof(laddr.v6.sin6_addr));
>  		laddr.v6.sin6_family = AF_INET6;
>  
>  		paddr.v6.sin6_port = req->id.idiag_dport;
> -		memcpy(&paddr.v6.sin6_addr, req->id.idiag_dst, 64);
> +		memcpy(&paddr.v6.sin6_addr, req->id.idiag_dst,
> +		       sizeof(paddr.v6.sin6_addr));
>  		paddr.v6.sin6_family = AF_INET6;
>  	}
>  
> -- 
> 2.5.5
> 

  parent reply	other threads:[~2016-08-23 17:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-23 15:40 [PATCH net] sctp: fix overrun in sctp_diag_dump_one() Lance Richardson
2016-08-23 16:23 ` Xin Long
2016-08-23 17:30 ` Marcelo Ricardo Leitner [this message]
2016-08-24  0:23 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160823173049.GA11144@localhost.localdomain \
    --to=marcelo.leitner@gmail.com \
    --cc=linux-sctp@vger.kernel.org \
    --cc=lrichard@redhat.com \
    --cc=lucien.xin@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).