Skip to content

Commit

Permalink
irda: Fix parameter extraction stack overflow
Browse files Browse the repository at this point in the history
Cc: stable@kernel.org
Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Signed-off-by: Samuel Ortiz <samuel@sortiz.org>
  • Loading branch information
Samuel Ortiz authored and Samuel Ortiz committed Oct 11, 2010
1 parent 3b06dbb commit efc463e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/irda/parameters.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 */

Expand Down

0 comments on commit efc463e

Please sign in to comment.