summaryrefslogtreecommitdiff
path: root/net/irda/iriap.c
diff options
context:
space:
mode:
authorDan Rosenberg <drosenberg@vsecurity.com>2011-03-20 18:32:06 +0300
committerDavid S. Miller <davem@davemloft.net>2011-03-28 04:59:02 +0400
commitd370af0ef7951188daeb15bae75db7ba57c67846 (patch)
treef884335124cf68d375afef3226a7378e6f5f3d33 /net/irda/iriap.c
parentd50e7e3604778bfc2dc40f440e0742dbae399d54 (diff)
downloadlinux-d370af0ef7951188daeb15bae75db7ba57c67846.tar.xz
irda: validate peer name and attribute lengths
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>
Diffstat (limited to 'net/irda/iriap.c')
-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 5b743bdd89ba..36477538cea8 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';