net: l2: wifi: Fix Print of SSID in WIFI status

While printing SSID in wifi status command, If the
length is maximum(32 character). It leads to buffer
overflow. It required one character for null
terminator ‘\0’. Changing the Format Specifiers to
print proper SSID.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
This commit is contained in:
Kapil Bhatt 2023-12-01 13:36:39 +05:30 committed by Fabio Baltieri
parent 6b644dff67
commit cb7b650b92

View file

@ -647,7 +647,7 @@ static int cmd_wifi_status(const struct shell *sh, size_t argc, char *argv[])
wifi_mode_txt(status.iface_mode));
shell_fprintf(sh, SHELL_NORMAL, "Link Mode: %s\n",
wifi_link_mode_txt(status.link_mode));
shell_fprintf(sh, SHELL_NORMAL, "SSID: %-32s\n", status.ssid);
shell_fprintf(sh, SHELL_NORMAL, "SSID: %.32s\n", status.ssid);
shell_fprintf(sh, SHELL_NORMAL, "BSSID: %s\n",
net_sprint_ll_addr_buf(status.bssid,
WIFI_MAC_ADDR_LEN, mac_string_buf,