libiw/iwscan.cpp: fix crash in case of different cmd order

Origin commit data
------------------
Branch: ni/coolstream
Commit: 40167afef4
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2014-07-16 (Wed, 16 Jul 2014)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
[CST] Focus
2014-07-16 11:52:24 +04:00
parent a8e4cf9709
commit 780c2f2809

View File

@@ -219,6 +219,11 @@ realloc:
if (ret <= 0)
break;
switch(event->cmd) {
case SIOCGIWAP:
count++;
networks.push_back(network);
printf(" Network %d:\n", count+1);
break;
case SIOCGIWESSID:
{
char essid[IW_ESSID_MAX_SIZE+1];
@@ -228,14 +233,12 @@ realloc:
if(event->u.essid.flags)
{
printf(" ESSID:\"%s\"\n", essid);
network.ssid = essid;
networks[count].ssid = essid;
}
else {
printf(" ESSID:off/any/hidden\n");
network.ssid = "(hidden)";
networks[count].ssid = "(hidden)";
}
count++;
networks.push_back(network);
}
break;