summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorDan Rosenberg <drosenberg@vsecurity.com>2011-03-20 15:32:06 +0000
committerWilly Tarreau <w@1wt.eu>2011-04-30 16:53:26 +0200
commitfa06b46ce9ab258e3815eb39354b30781fb48aa4 (patch)
tree84a8292d28e1e873f01a0e7bdeba790f081a1adc /net
parentc598f77065980e6ee1d374cf5e862c60563e33cf (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 1c339947f233..e6a585761095 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';