aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-05-30 11:37:35 +0000
committerFelix Fietkau <nbd@openwrt.org>2014-05-30 11:37:35 +0000
commita8c6710940ac8b64e36750a477b95dc248d90743 (patch)
tree94898a995f4d5b3ebdc1e16be3044e03e1275cf6 /package
parent6d92875c3b46793978709c6b6df4314fb0d3f0db (diff)
downloadupstream-a8c6710940ac8b64e36750a477b95dc248d90743.tar.gz
upstream-a8c6710940ac8b64e36750a477b95dc248d90743.tar.bz2
upstream-a8c6710940ac8b64e36750a477b95dc248d90743.zip
iwinfo: null-terminate the ssid on nl80211 scan to avoid printing trailing garbage
Signed-off-by: Felix Fietkau <nbd@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@40884 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package')
-rw-r--r--package/network/utils/iwinfo/src/iwinfo_nl80211.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/package/network/utils/iwinfo/src/iwinfo_nl80211.c b/package/network/utils/iwinfo/src/iwinfo_nl80211.c
index 4d0444a7aa..8e585892d7 100644
--- a/package/network/utils/iwinfo/src/iwinfo_nl80211.c
+++ b/package/network/utils/iwinfo/src/iwinfo_nl80211.c
@@ -1725,13 +1725,16 @@ static void nl80211_get_scanlist_ie(struct nlattr **bss,
int ielen = nla_len(bss[NL80211_BSS_INFORMATION_ELEMENTS]);
unsigned char *ie = nla_data(bss[NL80211_BSS_INFORMATION_ELEMENTS]);
static unsigned char ms_oui[3] = { 0x00, 0x50, 0xf2 };
+ int len;
while (ielen >= 2 && ielen >= ie[1])
{
switch (ie[0])
{
case 0: /* SSID */
- memcpy(e->ssid, ie + 2, min(ie[1], IWINFO_ESSID_MAX_SIZE));
+ len = min(ie[1], IWINFO_ESSID_MAX_SIZE);
+ memcpy(e->ssid, ie + 2, len);
+ e->ssid[len] = 0;
break;
case 48: /* RSN */