[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <efc463eb508798da4243625b08c7396462cabf9f.1286756123.git.sameo@linux.intel.com>
Date: Mon, 11 Oct 2010 02:25:01 +0200
From: Samuel Ortiz <samuel@...tiz.org>
To: "David S. Miller" <davem@...emloft.net>
Cc: netdev@...r.kernel.org, Samuel Ortiz <samuel@...tiz.org>,
stable@...nel.org
Subject: [PATCH net-next 4/5] irda: Fix parameter extraction stack overflow
Cc: stable@...nel.org
Reported-by: Ilja Van Sprundel <ivansprundel@...ctive.com>
Signed-off-by: Samuel Ortiz <samuel@...tiz.org>
---
net/irda/parameters.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/net/irda/parameters.c b/net/irda/parameters.c
index fc1a205..71cd38c 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 */
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists