mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-28 18:28:23 -05:00
JSON: Fix escaping of characters that have MSB=1 with signed char
The "\\u%04x" printf string did not really work in the correct way if char is signed. Fix this by type casting this to unsigned char. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
dcafde0c32
commit
1030dec1fa
@ -51,7 +51,7 @@ void json_escape_string(char *txt, size_t maxlen, const char *data, size_t len)
|
|||||||
*txt++ = data[i];
|
*txt++ = data[i];
|
||||||
} else {
|
} else {
|
||||||
txt += os_snprintf(txt, end - txt, "\\u%04x",
|
txt += os_snprintf(txt, end - txt, "\\u%04x",
|
||||||
data[i]);
|
(unsigned char) data[i]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user