mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-28 19:52:00 +01:00
Don't call memcpy with 0 size and NULL pointer(s)
It's undefined behavior, and ubsan flags it.
This commit is contained in:
@@ -62,7 +62,8 @@ int zmq::sub_t::xsetsockopt (int option_, const void *optval_,
|
||||
else
|
||||
if (option_ == ZMQ_UNSUBSCRIBE)
|
||||
*data = 0;
|
||||
memcpy (data + 1, optval_, optvallen_);
|
||||
if (optvallen_ > 0)
|
||||
memcpy (data + 1, optval_, optvallen_);
|
||||
|
||||
// Pass it further on in the stack.
|
||||
int err = 0;
|
||||
|
||||
Reference in New Issue
Block a user