commit e82dac4b2d8ae2fa8de0cd90ec03ad6ec764584d
parent dc38964e42eb4f5439ce666a433f6869ce63cab7
Author: Denis Kenzior <denkenz@gmail.com>
Date: Fri, 17 Mar 2023 15:19:09 -0500
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:
98b758f8934a ("knownnetworks: fix printing SSID in hex")
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/station.c b/src/station.c
@@ -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));