3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 09:39:25 +01:00

knownnetworks: fix printing SSID in hex

Force conversion to unsigned char before printing to avoid sign
extension when printing SSID in hex. For example, if there are CJK
characters in SSID, it will generate a very long string like
/net/connman/iwd/ffffffe8ffffffaeffffffa1.
This commit is contained in:
Jiajie Chen 2023-02-26 14:25:26 +08:00 committed by Denis Kenzior
parent 89309a8621
commit 98b758f893

View File

@ -174,7 +174,7 @@ static const char *known_network_get_path(const struct network_info *network)
for (i = 0; network->ssid[i] && pos < sizeof(path); i++)
pos += snprintf(path + pos, sizeof(path) - pos, "%02x",
network->ssid[i]);
(unsigned char)network->ssid[i]);
if (pos < sizeof(path))
snprintf(path + pos, sizeof(path) - pos, "_%s",