mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-10 16:06:09 +00:00
Problem: zmq::curve_server_t::produce_error sends sizeof std::string instead of status code length
Solution: send status code length (always 3) instead
This commit is contained in:
parent
e84804d4cc
commit
41108b203e
@ -572,13 +572,14 @@ int zmq::curve_server_t::produce_ready (msg_t *msg_)
|
|||||||
|
|
||||||
int zmq::curve_server_t::produce_error (msg_t *msg_) const
|
int zmq::curve_server_t::produce_error (msg_t *msg_) const
|
||||||
{
|
{
|
||||||
|
const size_t expected_status_code_length = 3;
|
||||||
zmq_assert (status_code.length () == 3);
|
zmq_assert (status_code.length () == 3);
|
||||||
const int rc = msg_->init_size (6 + 1 + status_code.length ());
|
const int rc = msg_->init_size (6 + 1 + expected_status_code_length);
|
||||||
zmq_assert (rc == 0);
|
zmq_assert (rc == 0);
|
||||||
char *msg_data = static_cast <char *> (msg_->data ());
|
char *msg_data = static_cast <char *> (msg_->data ());
|
||||||
memcpy (msg_data, "\5ERROR", 6);
|
memcpy (msg_data, "\5ERROR", 6);
|
||||||
msg_data [6] = sizeof status_code;
|
msg_data [6] = expected_status_code_length;
|
||||||
memcpy (msg_data + 7, status_code.c_str (), status_code.length ());
|
memcpy (msg_data + 7, status_code.c_str (), expected_status_code_length);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user