All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Rosenberg <drosenberg@vsecurity.com>
To: Samuel Ortiz <samuel@sortiz.org>
Cc: "David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, security@kernel.org
Subject: Re: [PATCH] irda: validate peer name and attribute lengths
Date: Mon, 21 Mar 2011 07:32:58 -0400	[thread overview]
Message-ID: <1300707178.9043.33.camel@dan> (raw)
In-Reply-To: <1300671126.9043.8.camel@dan>

On Sun, 2011-03-20 at 21:32 -0400, Dan Rosenberg wrote:
> Length fields provided by a peer for names and attributes may be longer
> than the destination array sizes.  Validate lengths to prevent stack
> buffer overflows.
> 

While this is the most serious bug I see, this function also seems to
lack any validation against skb->len.  If someone wants to take care of
this, by all means...if not, I'll post a follow-up patch in the next day
or so.

-Dan

> Signed-off-by: Dan Rosenberg <drosenberg@vsecurity.com>
> Cc: stable@kernel.org
> ---
>  net/irda/iriap.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/net/irda/iriap.c b/net/irda/iriap.c
> index 5b743bd..3647753 100644
> --- a/net/irda/iriap.c
> +++ b/net/irda/iriap.c
> @@ -656,10 +656,16 @@ static void iriap_getvaluebyclass_indication(struct iriap_cb *self,
>  	n = 1;
>  
>  	name_len = fp[n++];
> +
> +	IRDA_ASSERT(name_len < IAS_MAX_CLASSNAME + 1, return;);
> +
>  	memcpy(name, fp+n, name_len); n+=name_len;
>  	name[name_len] = '\0';
>  
>  	attr_len = fp[n++];
> +
> +	IRDA_ASSERT(attr_len < IAS_MAX_ATTRIBNAME + 1, return;);
> +
>  	memcpy(attr, fp+n, attr_len); n+=attr_len;
>  	attr[attr_len] = '\0';
>  
> 



  reply	other threads:[~2011-03-21 11:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-21  1:32 [PATCH] irda: validate peer name and attribute lengths Dan Rosenberg
2011-03-21 11:32 ` Dan Rosenberg [this message]
2011-03-28  0:59 ` 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=1300707178.9043.33.camel@dan \
    --to=drosenberg@vsecurity.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=samuel@sortiz.org \
    --cc=security@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 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.