Merge pull request #4023 from bluca/fuzzers

Problem: setsockopt of CURVE key ignores parameter length
This commit is contained in:
Doron Somech 2020-08-23 16:21:27 +03:00 committed by GitHub
commit 9fe56b175d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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];