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.
This commit is contained in:
Johanna Amann 2017-09-18 14:33:22 -07:00
parent c1f8e3baec
commit 2a873f5aed

View file

@ -1397,8 +1397,12 @@ void _set_processing_status(const char* status)
{ {
char buf[256]; char buf[256];
strerror_r(errno, buf, sizeof(buf)); strerror_r(errno, buf, sizeof(buf));
if ( reporter )
reporter->Error("Failed to open process status file '%s': %s", reporter->Error("Failed to open process status file '%s': %s",
proc_status_file, buf); proc_status_file, buf);
else
fprintf(stderr, "Failed to open process status file '%s': %s\n",
proc_status_file, buf);
errno = old_errno; errno = old_errno;
return; return;
} }