• Peter Huewe's avatar
    staging/rtl8192u/ieee80211: Fix buffer overflow in ieee80211_softmac_wx.c · 67a88e63
    Peter Huewe authored
    Clang/scan-build complains about a possible buffer overflow in
    ieee80211_wx_get_name:
    
    .../staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c:499:3:
    warning: String copy function overflows destination buffer
    	strcat(wrqu->name," link..");
    
    .../staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c:497:3:
    warning: String copy function overflows destination buffer
    	strcat(wrqu->name," linked");
    
    The buffer wrqu->name is only IFNAMSIZ bytes big (currently 16),
    so if we have a "802.11b/g/n linked" device we overrun the buffer by 3
    bytes.
    
    -> Use strlcopy / strlcat to populate the name.
    This is done in a similar fashion in
    staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c
    
    While at it cleaned some whitespace issues.
    Signed-off-by: default avatarPeter Huewe <peterhuewe@gmx.de>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    67a88e63
ieee80211_softmac_wx.c 14.1 KB