From 2a873f5aeddb1dc161c0ff64e566461bf225d9dc Mon Sep 17 00:00:00 2001 From: Johanna Amann Date: Mon, 18 Sep 2017 14:33:22 -0700 Subject: [PATCH] Prevent crash when calling bro -U [unwritable destination] set_processing_status can be called before reporter is initialized or after it is deleted. Work around by sending data to stderr instead. Patch by Thomas Petersen. --- src/util.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/util.cc b/src/util.cc index acfcb19573..a035da1739 100644 --- a/src/util.cc +++ b/src/util.cc @@ -1397,8 +1397,12 @@ void _set_processing_status(const char* status) { char buf[256]; strerror_r(errno, buf, sizeof(buf)); - reporter->Error("Failed to open process status file '%s': %s", - proc_status_file, buf); + if ( reporter ) + reporter->Error("Failed to open process status file '%s': %s", + proc_status_file, buf); + else + fprintf(stderr, "Failed to open process status file '%s': %s\n", + proc_status_file, buf); errno = old_errno; return; }