mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-29 05:39:24 +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:
parent
89309a8621
commit
98b758f893
@ -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++)
|
for (i = 0; network->ssid[i] && pos < sizeof(path); i++)
|
||||||
pos += snprintf(path + pos, sizeof(path) - pos, "%02x",
|
pos += snprintf(path + pos, sizeof(path) - pos, "%02x",
|
||||||
network->ssid[i]);
|
(unsigned char)network->ssid[i]);
|
||||||
|
|
||||||
if (pos < sizeof(path))
|
if (pos < sizeof(path))
|
||||||
snprintf(path + pos, sizeof(path) - pos, "_%s",
|
snprintf(path + pos, sizeof(path) - pos, "_%s",
|
||||||
|
Loading…
Reference in New Issue
Block a user