Merge fix for GH-1398 allowing null-bytes in ASCII input files

* Commits:
  Ascii reader test with 0-bytes
  Fix buffer overread in ascii formatter
This commit is contained in:
Jon Siwek 2021-02-12 11:18:32 -08:00
commit a636f8edbd
5 changed files with 18 additions and 2 deletions

10
CHANGES
View file

@ -1,4 +1,14 @@
4.1.0-dev.224 | 2021-02-12 11:18:32 -0800
* GH-1398: Fix buffer overread in ascii formatter (Johanna Amann, Corelight)
When a text with an (escaped) zero byte was passed to ParseValue, only
the part of the string up to the zero byte was copied, but the length of
the full string was passed to the input framework.
This leads to the input manager reading over the end of the buffer.
4.1.0-dev.220 | 2021-02-11 11:10:46 -0800
* GH-1399: Remove RocksDB configure script options (Jon Siwek, Corelight)

View file

@ -1 +1 @@
4.1.0-dev.220
4.1.0-dev.224

View file

@ -225,7 +225,9 @@ Value* Ascii::ParseValue(const string& s, const string& name, TypeTag type, Type
{
string unescaped = util::get_unescaped_string(s);
val->val.string_val.length = unescaped.size();
val->val.string_val.data = util::copy_string(unescaped.c_str());
val->val.string_val.data = new char[val->val.string_val.length];
// we do not need a zero-byte at the end - the input manager adds that explicitly
memcpy(val->val.string_val.data, unescaped.data(), unescaped.size());
break;
}

View file

@ -5,3 +5,7 @@ abc|\xffdef
DATA2
abc\xff|def
DATA2
abc\x00\x00\x00\xff|def
DATA3
abcd\x00\x00\x00ef
DATA4