projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3b06dbb
)
irda: Fix parameter extraction stack overflow
author
Samuel Ortiz
<
[email protected]
>
Sun, 10 Oct 2010 23:17:56 +0000
(
01:17
+0200)
committer
Samuel Ortiz
<
[email protected]
>
Mon, 11 Oct 2010 00:12:17 +0000
(
02:12
+0200)
Cc:
[email protected]
Reported-by: Ilja Van Sprundel <
[email protected]
>
Signed-off-by: Samuel Ortiz <
[email protected]
>
net/irda/parameters.c
patch
|
blob
|
history
diff --git
a/net/irda/parameters.c
b/net/irda/parameters.c
index fc1a20565e2d7ab3cbef897ac4ed2d5793189a62..71cd38c1a67fcfe241215effff78efba06be966c 100644
(file)
--- 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 */