From c2ee15b09f0ecf3701be68844d58b781bd517216 Mon Sep 17 00:00:00 2001 From: Julien Sentier Date: Thu, 23 Feb 2012 12:48:28 +0100 Subject: [PATCH] protection from bad frees on unallocated strings --- src/BroDoc.cc | 4 ++-- src/Debug.cc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/BroDoc.cc b/src/BroDoc.cc index b20db727ff..9c617f78b3 100644 --- a/src/BroDoc.cc +++ b/src/BroDoc.cc @@ -85,8 +85,8 @@ void BroDoc::AddImport(const std::string& s) if ( ext_pos != std::string::npos ) lname = lname.substr(0, ext_pos); - const char* full_filename = ""; - const char* subpath = ""; + const char* full_filename = NULL; + const char* subpath = NULL; FILE* f = search_for_file(lname.c_str(), "bro", &full_filename, true, &subpath); diff --git a/src/Debug.cc b/src/Debug.cc index 1b849fff7e..ea9c52f77e 100644 --- a/src/Debug.cc +++ b/src/Debug.cc @@ -142,7 +142,7 @@ int TraceState::LogTrace(const char* fmt, ...) if ( ! loc.filename ) { - loc.filename = ""; + loc.filename = copy_string(""); loc.last_line = 0; } @@ -735,7 +735,7 @@ string get_context_description(const Stmt* stmt, const Frame* frame) loc = *stmt->GetLocationInfo(); else { - loc.filename = ""; + loc.filename = copy_string(""); loc.last_line = 0; }