wapi: use strlen to calc the length of ssid
Avoid wrq.u.essid.length being different from the actual length Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
parent
5f166c09be
commit
673dcb8df8
@ -773,9 +773,9 @@ int wapi_set_essid(int sock, FAR const char *ifname, FAR const char *essid,
|
||||
|
||||
/* Prepare request. */
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s", essid);
|
||||
wrq.u.essid.pointer = buf;
|
||||
wrq.u.essid.length =
|
||||
snprintf(buf, ((WAPI_ESSID_MAX_SIZE + 1) * sizeof(char)), "%s", essid);
|
||||
wrq.u.essid.length = strlen(buf);
|
||||
wrq.u.essid.flags = flag;
|
||||
|
||||
strlcpy(wrq.ifr_name, ifname, IFNAMSIZ);
|
||||
|
Loading…
Reference in New Issue
Block a user