mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-17 08:34:00 +00:00
Merge pull request #502 from ianbarber/master
Add bounds check on upstream XSUB messages
This commit is contained in:
commit
7bc3e53b53
@ -87,7 +87,7 @@ int zmq::xsub_t::xsend (msg_t *msg_)
|
|||||||
size_t size = msg_->size ();
|
size_t size = msg_->size ();
|
||||||
unsigned char *data = (unsigned char*) msg_->data ();
|
unsigned char *data = (unsigned char*) msg_->data ();
|
||||||
|
|
||||||
if (*data == 1) {
|
if (size > 0 && *data == 1) {
|
||||||
// Process subscribe message
|
// Process subscribe message
|
||||||
// This used to filter out duplicate subscriptions,
|
// This used to filter out duplicate subscriptions,
|
||||||
// however this is alread done on the XPUB side and
|
// however this is alread done on the XPUB side and
|
||||||
@ -97,7 +97,7 @@ int zmq::xsub_t::xsend (msg_t *msg_)
|
|||||||
return dist.send_to_all (msg_);
|
return dist.send_to_all (msg_);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (*data == 0) {
|
if (size > 0 && *data == 0) {
|
||||||
// Process unsubscribe message
|
// Process unsubscribe message
|
||||||
if (subscriptions.rm (data + 1, size - 1))
|
if (subscriptions.rm (data + 1, size - 1))
|
||||||
return dist.send_to_all (msg_);
|
return dist.send_to_all (msg_);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user