mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 00:28:21 +00:00
Changed the escaping method.
This commit is contained in:
parent
ca5eb5382a
commit
8334dceadb
1 changed files with 7 additions and 3 deletions
|
@ -122,9 +122,13 @@ bool ElasticSearch::AddFieldValueToBuffer(Value* val, const Field* field)
|
||||||
// HTML entity encode special characters.
|
// HTML entity encode special characters.
|
||||||
if ( c < 32 || c > 126 || c == '\n' || c == '"' || c == '\'' || c == '\\' || c == '&' )
|
if ( c < 32 || c > 126 || c == '\n' || c == '"' || c == '\'' || c == '\\' || c == '&' )
|
||||||
{
|
{
|
||||||
buffer.AddRaw("&#", 2);
|
static const char hex_chars[] = "0123456789abcdef";
|
||||||
buffer.Add((uint8_t) c);
|
buffer.AddRaw("\\u00", 4);
|
||||||
buffer.AddRaw(";", 1);
|
buffer.AddRaw(&hex_chars[(c & 0xf0) >> 4], 1);
|
||||||
|
buffer.AddRaw(&hex_chars[c & 0x0f], 1);
|
||||||
|
//buffer.AddRaw("&#//", 2);
|
||||||
|
//buffer.Add((uint8_t) c);
|
||||||
|
//buffer.AddRaw(";", 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
buffer.AddRaw(&c, 1);
|
buffer.AddRaw(&c, 1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue