Commit efc463eb authored by Samuel Ortiz's avatar Samuel Ortiz Committed by Samuel Ortiz

irda: Fix parameter extraction stack overflow

Cc: stable@kernel.org
Reported-by: default avatarIlja Van Sprundel <ivansprundel@ioactive.com>
Signed-off-by: default avatarSamuel Ortiz <samuel@sortiz.org>
parent 3b06dbbe
......@@ -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 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment