P2P: Fix parsing of UTF-8 device names
The control character verification was supposed to only replace bytes 0..31, not 0..31 and 128..255 as happened on systems where char is signed.
This commit is contained in:
parent
be88391dee
commit
4e0c025d13
1 changed files with 3 additions and 2 deletions
|
@ -166,7 +166,8 @@ static int p2p_parse_attribute(u8 id, const u8 *data, u16 len,
|
|||
for (i = 0; i < nlen; i++) {
|
||||
if (msg->device_name[i] == '\0')
|
||||
break;
|
||||
if (msg->device_name[i] < 32)
|
||||
if (msg->device_name[i] > 0 &&
|
||||
msg->device_name[i] < 32)
|
||||
msg->device_name[i] = '_';
|
||||
}
|
||||
wpa_printf(MSG_DEBUG, "P2P: * Device Info: addr " MACSTR
|
||||
|
@ -563,7 +564,7 @@ static int p2p_group_info_text(const u8 *gi, size_t gi_len, char *buf,
|
|||
name[cli->dev_name_len] = '\0';
|
||||
count = (int) cli->dev_name_len - 1;
|
||||
while (count >= 0) {
|
||||
if (name[count] < 32)
|
||||
if (name[count] > 0 && name[count] < 32)
|
||||
name[count] = '_';
|
||||
count--;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue