diff options
author | AppaRao Puli <apparao.puli@linux.intel.com> | 2020-06-26 20:53:12 +0300 |
---|---|---|
committer | AppaRao Puli <apparao.puli@linux.intel.com> | 2020-06-29 07:27:51 +0300 |
commit | 5e715de6db4b032a64556a2aa69559c412774b20 (patch) | |
tree | 470b10e9a2e572f356b99532b7b060e13fc1b6ec /redfish-core | |
parent | b792cc565af5f804d5284ecec51ffbb560f31578 (diff) | |
download | bmcweb-5e715de6db4b032a64556a2aa69559c412774b20.tar.xz |
Fix: Replace span with vector
The message args in the event service data is
coming empty and also crashing bmcweb when multiple
arguments present. The boost::beast::span has issue
in passing it as reference to function for assignment.
Replaced span with std::vector to avoid empty response
to caller function.
Tested:
- All message arguments are working fine and resolved
crash.
Change-Id: I800247cfd0d5dba7698cdb3e60c1290e478bf3ac
Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
Diffstat (limited to 'redfish-core')
-rw-r--r-- | redfish-core/include/event_service_manager.hpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp index c48db09ed0..c11e31bbb9 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp @@ -58,7 +58,7 @@ static int fileWatchDesc = -1; // <ID, timestamp, RedfishLogId, registryPrefix, MessageId, MessageArgs> using EventLogObjectsType = std::tuple<std::string, std::string, std::string, std::string, std::string, - boost::beast::span<std::string>>; + std::vector<std::string>>; namespace message_registries { @@ -150,7 +150,7 @@ bool getUniqueEntryID(const std::string& logEntry, std::string& entryID, int getEventLogParams(const std::string& logEntry, std::string& timestamp, std::string& messageID, - boost::beast::span<std::string>& messageArgs) + std::vector<std::string>& messageArgs) { // The redfish log format is "<Timestamp> <MessageId>,<MessageArgs>" // First get the Timestamp @@ -184,13 +184,11 @@ int getEventLogParams(const std::string& logEntry, std::string& timestamp, { std::string& messageArgsStart = logEntryFields[1]; // If the first string is empty, assume there are no MessageArgs - std::size_t messageArgsSize = 0; if (!messageArgsStart.empty()) { - messageArgsSize = logEntryFields.size() - 1; + messageArgs.assign(logEntryFields.begin() + 1, + logEntryFields.end()); } - - messageArgs = boost::beast::span(&messageArgsStart, messageArgsSize); } return 0; @@ -215,7 +213,7 @@ void getRegistryAndMessageKey(const std::string& messageID, int formatEventLogEntry(const std::string& logEntryID, const std::string& messageID, - const boost::beast::span<std::string>& messageArgs, + const std::vector<std::string>& messageArgs, std::string timestamp, const std::string customText, nlohmann::json& logEntryJson) { @@ -351,8 +349,7 @@ class Subscription const std::string& messageID = std::get<2>(logEntry); const std::string& registryName = std::get<3>(logEntry); const std::string& messageKey = std::get<4>(logEntry); - const boost::beast::span<std::string>& messageArgs = - std::get<5>(logEntry); + const std::vector<std::string>& messageArgs = std::get<5>(logEntry); // If registryPrefixes list is empty, don't filter events // send everything. @@ -920,7 +917,7 @@ class EventServiceManager std::string timestamp; std::string messageID; - boost::beast::span<std::string> messageArgs; + std::vector<std::string> messageArgs; if (event_log::getEventLogParams(logEntry, timestamp, messageID, messageArgs) != 0) { |