From c7f077f1acdce116896cfd5761ed3d1e34fff61d Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Fri, 17 Apr 2015 12:43:43 +0200 Subject: [PATCH] Remove \n and \r from event descriptions. (cherry picked from commit 250ef13bcafe095072ddb9957a2a6e66688a597f) --- .../win32/modules/pandora_module_logevent.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pandora_agents/win32/modules/pandora_module_logevent.cc b/pandora_agents/win32/modules/pandora_module_logevent.cc index 0848edd824..0bdfa21379 100755 --- a/pandora_agents/win32/modules/pandora_module_logevent.cc +++ b/pandora_agents/win32/modules/pandora_module_logevent.cc @@ -257,7 +257,7 @@ Pandora_Module_Logevent::getLogEvents (list &event_list, unsigned char d TCHAR lp_referenced_domain_name[_MAX_PATH + 1]; DWORD cch_referenced_domain_name = _MAX_PATH + 1; SID_NAME_USE pe_use; - string description; + string description, output; if (this->log_event == NULL) { return -1; @@ -392,9 +392,19 @@ Pandora_Module_Logevent::getLogEvents (list &event_list, unsigned char d event << "]"; } + + // Remove carriage returns and new lines in between the description. + output = ""; + for (size_t i = 0; i < description.size(); i++) { + if (description[i] != '\n' && description[i] != '\r') { + output += description[i]; + } + } + output += '\n'; + // Print the event description event << " "; - event << description; + event << output; // Add the event to the list event_list.push_back (event.str());