mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-12 10:33:52 +01:00
Problem: ZMQ_METADATA setsockopt ignores length and assumes nUL-terminated string
Solution: use length too
This commit is contained in:
parent
241240b79f
commit
2fb04c1018
@ -761,7 +761,8 @@ int zmq::options_t::setsockopt (int option_,
|
||||
|
||||
case ZMQ_METADATA:
|
||||
if (optvallen_ > 0 && !is_int) {
|
||||
const std::string s (static_cast<const char *> (optval_));
|
||||
const std::string s (static_cast<const char *> (optval_),
|
||||
optvallen_);
|
||||
const size_t pos = s.find (':');
|
||||
if (pos != std::string::npos && pos != 0
|
||||
&& pos != s.length () - 1) {
|
||||
|
Loading…
Reference in New Issue
Block a user