mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-30 05:29:43 +01:00
Problem: artificial restriction on binary identities
Applications that use ZMQ_IDENTITY can be trapped by the artificial restriction on not using a binary zero as first byte. It's specially nasty on random generated identities, e.g. UUIDs, as the chance of a binary zero is low, so it will pass 255 out of 256 times. Solution: remove the restriction.
This commit is contained in:
@@ -89,11 +89,8 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
|
||||
break;
|
||||
|
||||
case ZMQ_IDENTITY:
|
||||
// Empty identity is invalid as well as identity longer than
|
||||
// 255 bytes. Identity starting with binary zero is invalid
|
||||
// as these are used for auto-generated identities.
|
||||
if (optvallen_ > 0 && optvallen_ < 256
|
||||
&& *((const unsigned char *) optval_) != 0) {
|
||||
// Identity is any binary string from 1 to 255 octets
|
||||
if (optvallen_ > 0 && optvallen_ < 256) {
|
||||
identity_size = optvallen_;
|
||||
memcpy (identity, optval_, identity_size);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user