mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Prevent String::Set from crashing if passed a nullptr
This commit is contained in:
parent
ecd970ffde
commit
b1e517e863
1 changed files with 8 additions and 5 deletions
|
@ -132,11 +132,14 @@ void String::Set(const char* str)
|
|||
{
|
||||
Reset();
|
||||
|
||||
n = strlen(str);
|
||||
b = new u_char[n+1];
|
||||
memcpy(b, str, n+1);
|
||||
final_NUL = true;
|
||||
use_free_to_delete = false;
|
||||
if ( str )
|
||||
{
|
||||
n = strlen(str);
|
||||
b = new u_char[n+1];
|
||||
memcpy(b, str, n+1);
|
||||
final_NUL = true;
|
||||
use_free_to_delete = false;
|
||||
}
|
||||
}
|
||||
|
||||
void String::Set(const std::string& str)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue