mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-06 00:31:13 +01:00
Problem: setsockopt of CURVE key ignores parameter length
Solution: create std::string using length to avoid overflow
This commit is contained in:
parent
8cc56d9f0f
commit
97f8274129
@ -276,13 +276,16 @@ int zmq::options_t::set_curve_key (uint8_t *destination_,
|
|||||||
mechanism = ZMQ_CURVE;
|
mechanism = ZMQ_CURVE;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case CURVE_KEYSIZE_Z85 + 1:
|
case CURVE_KEYSIZE_Z85 + 1: {
|
||||||
if (zmq_z85_decode (destination_,
|
const std::string s (static_cast<const char *> (optval_),
|
||||||
reinterpret_cast<const char *> (optval_))) {
|
optvallen_);
|
||||||
|
|
||||||
|
if (zmq_z85_decode (destination_, s.c_str ())) {
|
||||||
mechanism = ZMQ_CURVE;
|
mechanism = ZMQ_CURVE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case CURVE_KEYSIZE_Z85:
|
case CURVE_KEYSIZE_Z85:
|
||||||
char z85_key[CURVE_KEYSIZE_Z85 + 1];
|
char z85_key[CURVE_KEYSIZE_Z85 + 1];
|
||||||
|
Loading…
Reference in New Issue
Block a user