diff options
Diffstat (limited to 'net/irda')
-rw-r--r-- | net/irda/iriap.c | 3 | ||||
-rw-r--r-- | net/irda/parameters.c | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/net/irda/iriap.c b/net/irda/iriap.c index fce364c6c71a..5b743bdd89ba 100644 --- a/net/irda/iriap.c +++ b/net/irda/iriap.c | |||
@@ -502,7 +502,8 @@ static void iriap_getvaluebyclass_confirm(struct iriap_cb *self, | |||
502 | IRDA_DEBUG(4, "%s(), strlen=%d\n", __func__, value_len); | 502 | IRDA_DEBUG(4, "%s(), strlen=%d\n", __func__, value_len); |
503 | 503 | ||
504 | /* Make sure the string is null-terminated */ | 504 | /* Make sure the string is null-terminated */ |
505 | fp[n+value_len] = 0x00; | 505 | if (n + value_len < skb->len) |
506 | fp[n + value_len] = 0x00; | ||
506 | IRDA_DEBUG(4, "Got string %s\n", fp+n); | 507 | IRDA_DEBUG(4, "Got string %s\n", fp+n); |
507 | 508 | ||
508 | /* Will truncate to IAS_MAX_STRING bytes */ | 509 | /* Will truncate to IAS_MAX_STRING bytes */ |
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, | |||
298 | 298 | ||
299 | p.pi = pi; /* In case handler needs to know */ | 299 | p.pi = pi; /* In case handler needs to know */ |
300 | p.pl = buf[1]; /* Extract length of value */ | 300 | p.pl = buf[1]; /* Extract length of value */ |
301 | if (p.pl > 32) | ||
302 | p.pl = 32; | ||
301 | 303 | ||
302 | IRDA_DEBUG(2, "%s(), pi=%#x, pl=%d\n", __func__, | 304 | IRDA_DEBUG(2, "%s(), pi=%#x, pl=%d\n", __func__, |
303 | p.pi, p.pl); | 305 | p.pi, p.pl); |
@@ -318,7 +320,7 @@ static int irda_extract_string(void *self, __u8 *buf, int len, __u8 pi, | |||
318 | (__u8) str[0], (__u8) str[1]); | 320 | (__u8) str[0], (__u8) str[1]); |
319 | 321 | ||
320 | /* Null terminate string */ | 322 | /* Null terminate string */ |
321 | str[p.pl+1] = '\0'; | 323 | str[p.pl] = '\0'; |
322 | 324 | ||
323 | p.pv.c = str; /* Handler will need to take a copy */ | 325 | p.pv.c = str; /* Handler will need to take a copy */ |
324 | 326 | ||