mirror of
https://github.com/zeromq/libzmq.git
synced 2025-07-04 09:37:15 +02: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:
|
case ZMQ_METADATA:
|
||||||
if (optvallen_ > 0 && !is_int) {
|
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 (':');
|
const size_t pos = s.find (':');
|
||||||
if (pos != std::string::npos && pos != 0
|
if (pos != std::string::npos && pos != 0
|
||||||
&& pos != s.length () - 1) {
|
&& pos != s.length () - 1) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user