Commit f884fa72 authored by Simon Giesecke's avatar Simon Giesecke

Problem: get_monitor_event_internal segfaults when using address

Solution: dereference the pointer to the array before accessing the
element
parent b18d28ee
......@@ -71,7 +71,7 @@ static int get_monitor_event_internal (void *monitor_,
size_t size = zmq_msg_size (&msg);
*address_ = (char *) malloc (size + 1);
memcpy (*address_, data, size);
*address_[size] = 0;
(*address_)[size] = 0;
}
return event;
}
......@@ -236,7 +236,7 @@ static int64_t get_monitor_event_internal_v2 (void *monitor_,
size_t size = zmq_msg_size (&msg);
*local_address_ = (char *) malloc (size + 1);
memcpy (*local_address_, data, size);
*local_address_[size] = 0;
(*local_address_)[size] = 0;
}
// Fourth and last frame in message contains remote address
......@@ -250,7 +250,7 @@ static int64_t get_monitor_event_internal_v2 (void *monitor_,
size_t size = zmq_msg_size (&msg);
*remote_address_ = (char *) malloc (size + 1);
memcpy (*remote_address_, data, size);
*remote_address_[size] = 0;
(*remote_address_)[size] = 0;
}
return event;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment