storage: ensure SSID strings are NULL-terminated

SSID_MAX_LEN is set at 32, which is the maximum allowed size of a SSID.
The strings holding SSIDs were set at that same size, which does not
allow for proper string termination.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
This commit is contained in:
Eneas U de Queiroz 2021-07-06 17:42:03 -03:00 committed by Polynomdivision
parent 8ce09d64de
commit a22f5a79d6
4 changed files with 5 additions and 5 deletions

View file

@ -281,8 +281,7 @@ int get_ssid(const char *ifname, char* ssid, size_t ssidmax) {
if (iw->ssid(ifname, buf))
memset(buf, 0, sizeof(buf));
memcpy(ssid, buf, ssidmax);
strcpy(ssid, buf);
strncpy(ssid, buf, ssidmax);
iwinfo_finish();
return 0;
}