wapi: Fix disconnect crash.
The ssid string has no terminator, which causes a out of bounds. Signed-off-by: liqinhui <liqinhui@xiaomi.com>
This commit is contained in:
parent
4576b3923c
commit
5ae44f9bc4
@ -429,7 +429,7 @@ int wpa_driver_wext_get_auth_param(int sockfd, FAR const char *ifname,
|
|||||||
|
|
||||||
void wpa_driver_wext_disconnect(int sockfd, FAR const char *ifname)
|
void wpa_driver_wext_disconnect(int sockfd, FAR const char *ifname)
|
||||||
{
|
{
|
||||||
uint8_t ssid[WAPI_ESSID_MAX_SIZE];
|
uint8_t ssid[WAPI_ESSID_MAX_SIZE + 1];
|
||||||
const struct ether_addr bssid =
|
const struct ether_addr bssid =
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
@ -471,6 +471,8 @@ void wpa_driver_wext_disconnect(int sockfd, FAR const char *ifname)
|
|||||||
ssid[i] = rand() & 0xff;
|
ssid[i] = rand() & 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ssid[WAPI_ESSID_MAX_SIZE] = '\0';
|
||||||
|
|
||||||
if (wapi_set_essid(sockfd, ifname,
|
if (wapi_set_essid(sockfd, ifname,
|
||||||
(FAR const char *)ssid, WAPI_ESSID_OFF) < 0)
|
(FAR const char *)ssid, WAPI_ESSID_OFF) < 0)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user