WebSockets: also json-escape strings in state messages

This commit is contained in:
Luciano Iam 2020-04-22 18:17:13 +02:00 committed by Robin Gareus
parent 946094b25c
commit dbb26daafa
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
7 changed files with 82 additions and 29 deletions

View file

@ -26,6 +26,7 @@
#include <sstream>
#include "message.h"
#include "json.h"
// JSON does not support Infinity or NaN
#define XSTR(s) STR (s)
@ -166,7 +167,7 @@ NodeStateMessage::serialize (void* buf, size_t len) const
break;
}
case TypedValue::String:
ss << '"' << static_cast<std::string> (val) << '"';
ss << '"' << Json::escape (static_cast<std::string> (val)) << '"';
break;
default:
break;