aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorDan Rosenberg <drosenberg@vsecurity.com>2011-03-20 15:32:06 +0000
committerGreg Kroah-Hartman <gregkh@suse.de>2011-04-14 16:52:52 -0700
commit0fc3fc08ecdb5496de33fb55955a0dab1a633329 (patch)
treeadc60bd5703581335dca63ebe64545c3c899cdfe /net
parent7de774750bc8dee73855df5bf7aa4c92e7446088 (diff)
irda: validate peer name and attribute lengths
commit d370af0ef7951188daeb15bae75db7ba57c67846 upstream. 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> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'net')
-rw-r--r--net/irda/iriap.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/net/irda/iriap.c b/net/irda/iriap.c
index f7d6150e090..35a338b6d89 100644
--- a/net/irda/iriap.c
+++ b/net/irda/iriap.c
@@ -655,10 +655,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';