Unverified Commit de845bd0 authored by Luca Boccassi's avatar Luca Boccassi Committed by GitHub

Merge pull request #3705 from somdoron/ws_mechanism

problem: zero-sized messages cause assertion when glibc assertion are on
parents 539718f3 9b15658e
......@@ -70,6 +70,7 @@ int zmq::curve_mechanism_base_t::encode (msg_t *msg_)
message_plaintext[crypto_box_ZEROBYTES] = flags;
// this is copying the data from insecure memory, so there is no point in
// using secure_allocator_t for message_plaintext
if (msg_->size () > 0)
memcpy (&message_plaintext[crypto_box_ZEROBYTES + 1], msg_->data (),
msg_->size ());
......@@ -160,6 +161,7 @@ int zmq::curve_mechanism_base_t::decode (msg_t *msg_)
// this is copying the data to insecure memory, so there is no point in
// using secure_allocator_t for message_plaintext
if (msg_->size () > 0)
memcpy (msg_->data (), &message_plaintext[crypto_box_ZEROBYTES + 1],
msg_->size ());
} else {
......
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