diff --git a/src/ZeekString.cc b/src/ZeekString.cc index 350d712a01..5a034ada03 100644 --- a/src/ZeekString.cc +++ b/src/ZeekString.cc @@ -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)