Hi,

I am learning zeroMQ and have implemented simple XSUB/XPUB proxy as outlined in 
the guide.

I have a SUB client that consumes 10 messages and exits. When that happens, 
there is a crash in XSUB/XPUB zmq_proxy function on the line highlighted below.
Has anybody else seen this and is this a bug that should be fixed? The data is 
NULL and size_ is 0.

void zmq::xpub_t::send_unsubscription (unsigned char *data_, size_t size_,
    void *arg_)
{
    xpub_t *self = (xpub_t*) arg_;

    if (self->options.type != ZMQ_PUB) {

              //  Place the unsubscription to the queue of pending 
(un)sunscriptions
              //  to be retrived by the user later on.
              blob_t unsub (size_ + 1, 0);
              unsub [0] = 0;
              if (size_ > 0)  <<---- Added check to prevent crash
                     memcpy (&unsub [1], data_, size_); <<-----------------
              self->pending.push_back (unsub);
    }
}


Thanks,

Katerina

_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to