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:
Jouni Malinen 2019-10-27 17:08:31 +02:00
parent dcafde0c32
commit 1030dec1fa

View File

@ -51,7 +51,7 @@ void json_escape_string(char *txt, size_t maxlen, const char *data, size_t len)
*txt++ = data[i];
} else {
txt += os_snprintf(txt, end - txt, "\\u%04x",
data[i]);
(unsigned char) data[i]);
}
break;
}