Commit 3a1bd784 authored by Thomas Daede's avatar Thomas Daede

Remove nonprinting characters when escaping JSON.

Change-Id: I41fe97db4cee333e601356253f28186ef4036237
parent 292c8e09
......@@ -258,7 +258,9 @@ int put_str_with_escape(char *buffer, const char *str) {
int i;
int j = 0;
for (i = 0; str[i] != '\0'; i++) {
if (str[i] == '"' || str[i] == '\\') {
if (str[i] < ' ') {
continue;
} else if (str[i] == '"' || str[i] == '\\') {
buffer[j++] = '\\';
}
buffer[j++] = str[i];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment