Skip to content
Snippets Groups Projects
Commit 492a0dc6 authored by Claudio Bisegni's avatar Claudio Bisegni
Browse files

fix the event server invalid write

parent 3e8abe9d
No related branches found
No related tags found
No related merge requests found
......@@ -48,7 +48,7 @@ public chaos::metadata_service_client::event::alert::AlertLogEventHandler {
public:
void handleLogEvent(const std::string& source,
const std::string& domain) {
MSCT_INFO << source << "-" << domain;
MSCT_INFO << "EVENT---->" << source << "-" << domain;
}
};
......
......@@ -45,13 +45,13 @@ void EventServer::dispatchEventToHandler(const unsigned char * const serializedE
if(*((uint16_t*)serializedEvent) != 0x4345) throw CException(2, "Bad event signature", "EventServer::dispatchEventToHandler");
if(length > EVT_DATA_MAX_BYTE_LENGTH) throw CException(1, "Event memory size exceed the max allowed", "EventServer::dispatchEventToHandler");
//check the type
//check the type
auto_ptr<EventTypeAndPriority> eventTypeAndHeaderPtr(new EventTypeAndPriority());
//get header swapped checking endian conversion
*((uint16_t*)eventTypeAndHeaderPtr.get()) = byte_swap<little_endian, host_endian, uint16_t>(*((uint16_t*)(serializedEvent+EVT_HEADER_BYTE_LENGTH)));
//get header swapped checking endian conversion
*((uint8_t*)eventTypeAndHeaderPtr.get()) = byte_swap<little_endian, host_endian, uint8_t>(*((uint8_t*)(serializedEvent+EVT_HEADER_BYTE_LENGTH)));
//dispatcher the event in the root handler on one of the fourth method
//dispatcher the event in the root handler on one of the fourth method
switch (eventTypeAndHeaderPtr->type) {
case EventTypeAlert: {
alert::AlertEventDescriptor *result = new alert::AlertEventDescriptor();
......@@ -74,4 +74,4 @@ void EventServer::dispatchEventToHandler(const unsigned char * const serializedE
DECODE_CHAOS_EXCEPTION(ex);
}
}
\ No newline at end of file
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment