summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorSamuel Ortiz <samuel@sortiz.org>2010-10-11 01:17:56 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2010-10-11 02:12:17 +0200
commitefc463eb508798da4243625b08c7396462cabf9f (patch)
tree2fd36e3c2d42182b67521010c11af1ceb2b754e7 /net
parent3b06dbbeadb6488cd00999b61b080bb6f0218503 (diff)
downloadlinux-efc463eb508798da4243625b08c7396462cabf9f.tar.bz2
irda: Fix parameter extraction stack overflow
Cc: stable@kernel.org Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com> Signed-off-by: Samuel Ortiz <samuel@sortiz.org>
Diffstat (limited to 'net')
-rw-r--r--net/irda/parameters.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/irda/parameters.c b/net/irda/parameters.c
index fc1a20565e2d..71cd38c1a67f 100644
--- a/net/irda/parameters.c
+++ b/net/irda/parameters.c
@@ -298,6 +298,8 @@ static int irda_extract_string(void *self, __u8 *buf, int len, __u8 pi,
p.pi = pi; /* In case handler needs to know */
p.pl = buf[1]; /* Extract length of value */
+ if (p.pl > 32)
+ p.pl = 32;
IRDA_DEBUG(2, "%s(), pi=%#x, pl=%d\n", __func__,
p.pi, p.pl);
@@ -318,7 +320,7 @@ static int irda_extract_string(void *self, __u8 *buf, int len, __u8 pi,
(__u8) str[0], (__u8) str[1]);
/* Null terminate string */
- str[p.pl+1] = '\0';
+ str[p.pl] = '\0';
p.pv.c = str; /* Handler will need to take a copy */