Skip to content

Commit

Permalink
irda: validate peer name and attribute lengths
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Dan Rosenberg <drosenberg@vsecurity.com>
Cc: stable@kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Dan Rosenberg authored and David S. Miller committed Mar 28, 2011
1 parent d50e7e3 commit d370af0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions net/irda/iriap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down

0 comments on commit d370af0

Please sign in to comment.