mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 01:28:20 +00:00
Fix creating a StringVal from std::string.
Currently, creating a StringVal from a std::string did not work with data that contains \0 characters. This easy fix changes this - and should also lead to a small speed increase for code using this constructor. This obviously means that more data might copied now in some cases that were previously cut off at the first 0-byte. Our test-suite did not reveal any such cases.
This commit is contained in:
parent
f810de11fa
commit
44b657687a
3 changed files with 3 additions and 3 deletions
|
@ -710,7 +710,7 @@ StringVal::StringVal(const char* s) : Val(TYPE_STRING)
|
|||
|
||||
StringVal::StringVal(const string& s) : Val(TYPE_STRING)
|
||||
{
|
||||
val.string_val = new BroString(s.c_str());
|
||||
val.string_val = new BroString(reinterpret_cast<const u_char*>(s.data()), s.length(), 1);
|
||||
}
|
||||
|
||||
StringVal* StringVal::ToUpper()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue