]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
irda: validate peer name and attribute lengths
authorDan Rosenberg <drosenberg@vsecurity.com>
Sun, 20 Mar 2011 15:32:06 +0000 (15:32 +0000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 14 Apr 2011 23:52:52 +0000 (16:52 -0700)
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>
net/irda/iriap.c

index f7d6150e0903cb7ad0d873ed22958f0c5f97f9df..35a338b6d897c7ee1c71f00ddf8d0fb67116bedd 100644 (file)
@@ -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';