Staging: prevent rtl8192su from crashing dev_ioctl in SIOCGIWNAME
authorDan Aloni <dan@aloni.org>
Wed, 24 Jun 2009 19:34:39 +0000 (22:34 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sun, 12 Jul 2009 20:21:45 +0000 (13:21 -0700)
commit91fca6da389b897483b4c1edea29885172989fda
tree750c7f198301660c028f09264f361f4edb16de3d
parent02c8baecf5d8850dba40b47cdf003ed2e04e66dd
Staging: prevent rtl8192su from crashing dev_ioctl in SIOCGIWNAME

(adapted from the rtl8187se patch)

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>
drivers/staging/rtl8192su/ieee80211/ieee80211_softmac_wx.c