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
1 changed files with 2 additions and 2 deletions

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));