diff options
author | Dan Aloni <dan@aloni.org> | 2009-06-20 09:32:22 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-07-12 16:21:45 -0400 |
commit | 02c8baecf5d8850dba40b47cdf003ed2e04e66dd (patch) | |
tree | 78cb75f4d14bb25c72893e66da5a6c1d94a13924 /drivers | |
parent | 77b9288197b6034c44abe2619aff62cba056a713 (diff) |
Staging: prevent rtl8187se from crashing dev_ioctl() in SIOCGIWNAME
I repeatedly get __stack_chk_fail panic()s with this driver before
applying the attached fix.
ieee80211_wx_get_name() ignores sizeof(wrqu->name) which is IFNAMSIZ (16), and
on certain conditions, the concatenated string will be larger than IFNAMSIZ
including the terminating zero.
length ("802.11" ++ "b" ++ "/g" ++ " linked" ++ "\x00") == 17
This fix uses strl{cpy,cat} in addition to the reduction of the total
possible length of the output string by a char.
It can be applied to 2.6.30-stable as well.
Signed-off-by: Dan Aloni <dan@aloni.org>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c index 93af37e2d31a..54b4b718f84a 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c | |||
@@ -461,19 +461,19 @@ int ieee80211_wx_get_name(struct ieee80211_device *ieee, | |||
461 | struct iw_request_info *info, | 461 | struct iw_request_info *info, |
462 | union iwreq_data *wrqu, char *extra) | 462 | union iwreq_data *wrqu, char *extra) |
463 | { | 463 | { |
464 | strcpy(wrqu->name, "802.11"); | 464 | strlcpy(wrqu->name, "802.11", IFNAMSIZ); |
465 | if(ieee->modulation & IEEE80211_CCK_MODULATION){ | 465 | if(ieee->modulation & IEEE80211_CCK_MODULATION){ |
466 | strcat(wrqu->name, "b"); | 466 | strlcat(wrqu->name, "b", IFNAMSIZ); |
467 | if(ieee->modulation & IEEE80211_OFDM_MODULATION) | 467 | if(ieee->modulation & IEEE80211_OFDM_MODULATION) |
468 | strcat(wrqu->name, "/g"); | 468 | strlcat(wrqu->name, "/g", IFNAMSIZ); |
469 | }else if(ieee->modulation & IEEE80211_OFDM_MODULATION) | 469 | }else if(ieee->modulation & IEEE80211_OFDM_MODULATION) |
470 | strcat(wrqu->name, "g"); | 470 | strlcat(wrqu->name, "g", IFNAMSIZ); |
471 | 471 | ||
472 | if((ieee->state == IEEE80211_LINKED) || | 472 | if((ieee->state == IEEE80211_LINKED) || |
473 | (ieee->state == IEEE80211_LINKED_SCANNING)) | 473 | (ieee->state == IEEE80211_LINKED_SCANNING)) |
474 | strcat(wrqu->name," linked"); | 474 | strlcat(wrqu->name," link", IFNAMSIZ); |
475 | else if(ieee->state != IEEE80211_NOLINK) | 475 | else if(ieee->state != IEEE80211_NOLINK) |
476 | strcat(wrqu->name," link.."); | 476 | strlcat(wrqu->name," .....", IFNAMSIZ); |
477 | 477 | ||
478 | 478 | ||
479 | return 0; | 479 | return 0; |