mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-14 15:54:15 +08:00
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>
This commit is contained in:
parent
77b9288197
commit
02c8baecf5
@ -461,19 +461,19 @@ int ieee80211_wx_get_name(struct ieee80211_device *ieee,
|
||||
struct iw_request_info *info,
|
||||
union iwreq_data *wrqu, char *extra)
|
||||
{
|
||||
strcpy(wrqu->name, "802.11");
|
||||
strlcpy(wrqu->name, "802.11", IFNAMSIZ);
|
||||
if(ieee->modulation & IEEE80211_CCK_MODULATION){
|
||||
strcat(wrqu->name, "b");
|
||||
strlcat(wrqu->name, "b", IFNAMSIZ);
|
||||
if(ieee->modulation & IEEE80211_OFDM_MODULATION)
|
||||
strcat(wrqu->name, "/g");
|
||||
strlcat(wrqu->name, "/g", IFNAMSIZ);
|
||||
}else if(ieee->modulation & IEEE80211_OFDM_MODULATION)
|
||||
strcat(wrqu->name, "g");
|
||||
strlcat(wrqu->name, "g", IFNAMSIZ);
|
||||
|
||||
if((ieee->state == IEEE80211_LINKED) ||
|
||||
(ieee->state == IEEE80211_LINKED_SCANNING))
|
||||
strcat(wrqu->name," linked");
|
||||
strlcat(wrqu->name," link", IFNAMSIZ);
|
||||
else if(ieee->state != IEEE80211_NOLINK)
|
||||
strcat(wrqu->name," link..");
|
||||
strlcat(wrqu->name," .....", IFNAMSIZ);
|
||||
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user