All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] sctp: fix overrun in sctp_diag_dump_one()
@ 2016-08-23 15:40 Lance Richardson
  2016-08-23 16:23   ` Xin Long
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Lance Richardson @ 2016-08-23 15:40 UTC (permalink / raw)
  To: netdev

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>
---
 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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net] sctp: fix overrun in sctp_diag_dump_one()
  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
  2016-08-24  0:23 ` David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: Xin Long @ 2016-08-23 16:23 UTC (permalink / raw)
  To: Lance Richardson; +Cc: network dev, linux-sctp

On Tue, Aug 23, 2016 at 11:40 PM, Lance Richardson <lrichard@redhat.com> 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>
> ---
>  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
>

Reviewed-by: Xin Long <lucien.xin@gmail.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net] sctp: fix overrun in sctp_diag_dump_one()
@ 2016-08-23 16:23   ` Xin Long
  0 siblings, 0 replies; 6+ messages in thread
From: Xin Long @ 2016-08-23 16:23 UTC (permalink / raw)
  To: Lance Richardson; +Cc: network dev, linux-sctp

On Tue, Aug 23, 2016 at 11:40 PM, Lance Richardson <lrichard@redhat.com> 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>
> ---
>  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
>

Reviewed-by: Xin Long <lucien.xin@gmail.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net] sctp: fix overrun in sctp_diag_dump_one()
  2016-08-23 15:40 [PATCH net] sctp: fix overrun in sctp_diag_dump_one() Lance Richardson
@ 2016-08-23 17:30   ` Marcelo Ricardo Leitner
  2016-08-23 17:30   ` Marcelo Ricardo Leitner
  2016-08-24  0:23 ` David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: Marcelo Ricardo Leitner @ 2016-08-23 17:30 UTC (permalink / raw)
  To: Lance Richardson; +Cc: netdev, linux-sctp, Xin Long

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
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net] sctp: fix overrun in sctp_diag_dump_one()
@ 2016-08-23 17:30   ` Marcelo Ricardo Leitner
  0 siblings, 0 replies; 6+ messages in thread
From: Marcelo Ricardo Leitner @ 2016-08-23 17:30 UTC (permalink / raw)
  To: Lance Richardson; +Cc: netdev, linux-sctp, Xin Long

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
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net] sctp: fix overrun in sctp_diag_dump_one()
  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
@ 2016-08-24  0:23 ` David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2016-08-24  0:23 UTC (permalink / raw)
  To: lrichard; +Cc: netdev

From: Lance Richardson <lrichard@redhat.com>
Date: Tue, 23 Aug 2016 11:40:52 -0400

> 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>

Applied and queued up for -stable, thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-08-24  0:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 16:23   ` Xin Long
2016-08-23 17:30 ` Marcelo Ricardo Leitner
2016-08-23 17:30   ` Marcelo Ricardo Leitner
2016-08-24  0:23 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.