GUACAMOLE-1215: Add backslash to list of JSON-escaped characters.

This commit is contained in:
Virtually Nick 2021-05-17 14:14:48 -04:00
parent df25aa9fdc
commit 0182de6d18

View File

@ -97,15 +97,15 @@ int guac_common_json_write_string(guac_user* user,
const char* current = str; const char* current = str;
for (; *current != '\0'; current++) { for (; *current != '\0'; current++) {
/* Escape all quotes */ /* Escape all quotes and back-slashes */
if (*current == '"') { if (*current == '"' || *current == '\\') {
/* Write any string content up to current character */ /* Write any string content up to current character */
if (current != str) if (current != str)
blob_written |= guac_common_json_write(user, stream, blob_written |= guac_common_json_write(user, stream,
json_state, str, current - str); json_state, str, current - str);
/* Escape the quote that was just read */ /* Escape the character that was just read */
blob_written |= guac_common_json_write(user, stream, blob_written |= guac_common_json_write(user, stream,
json_state, "\\", 1); json_state, "\\", 1);