3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 06:29:23 +01:00

station: Fix potential buffer overflow

Use a more appropriate printf conversion string in order to avoid
unnecessary implicit conversion which can lead to a buffer overflow.
Reasons similar to commit:
98b758f893 ("knownnetworks: fix printing SSID in hex")
This commit is contained in:
Denis Kenzior 2023-03-17 15:19:09 -05:00
parent dc38964e42
commit e82dac4b2d

View File

@ -368,8 +368,8 @@ static const char *iwd_network_get_path(struct station *station,
netdev_get_path(station->netdev));
for (i = 0; ssid[i] && pos < sizeof(path); i++)
pos += snprintf(path + pos, sizeof(path) - pos, "%02x",
ssid[i]);
pos += snprintf(path + pos, sizeof(path) - pos, "%02hhx",
ssid[i]);
snprintf(path + pos, sizeof(path) - pos, "_%s",
security_to_str(security));