P2P: Do not print control characters in debug

Do not print the received country code as characters if it includes
control characters.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
Jouni Malinen 2023-07-18 11:15:15 +03:00 committed by Jouni Malinen
parent b2a1e7fe7a
commit 518ae8c7cc

View file

@ -93,6 +93,12 @@ static int p2p_parse_attribute(u8 id, const u8 *data, u16 len,
return -1;
}
msg->listen_channel = data;
if (has_ctrl_char(data, 2)) {
wpa_printf(MSG_DEBUG,
"P2P: * Listen Channel: Country(binary) %02x %02x (0x%02x) Regulatory Class %d Channel Number %d",
data[0], data[1], data[2], data[3], data[4]);
break;
}
wpa_printf(MSG_DEBUG, "P2P: * Listen Channel: "
"Country %c%c(0x%02x) Regulatory "
"Class %d Channel Number %d", data[0], data[1],
@ -110,6 +116,12 @@ static int p2p_parse_attribute(u8 id, const u8 *data, u16 len,
return -1;
}
msg->operating_channel = data;
if (has_ctrl_char(data, 2)) {
wpa_printf(MSG_DEBUG,
"P2P: * Operating Channel: Country(binary) %02x %02x (0x%02x) Regulatory Class %d Channel Number %d",
data[0], data[1], data[2], data[3], data[4]);
break;
}
wpa_printf(MSG_DEBUG, "P2P: * Operating Channel: "
"Country %c%c(0x%02x) Regulatory "
"Class %d Channel Number %d", data[0], data[1],
@ -123,8 +135,15 @@ static int p2p_parse_attribute(u8 id, const u8 *data, u16 len,
}
msg->channel_list = data;
msg->channel_list_len = len;
wpa_printf(MSG_DEBUG, "P2P: * Channel List: Country String "
"'%c%c(0x%02x)'", data[0], data[1], data[2]);
if (has_ctrl_char(data, 2)) {
wpa_printf(MSG_DEBUG,
"P2P: * Channel List: Country String (binary) %02x %02x (0x%02x)",
data[0], data[1], data[2]);
} else {
wpa_printf(MSG_DEBUG,
"P2P: * Channel List: Country String '%c%c(0x%02x)'",
data[0], data[1], data[2]);
}
wpa_hexdump(MSG_MSGDUMP, "P2P: Channel List",
msg->channel_list, msg->channel_list_len);
break;