mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-10 07:56:09 +00:00
Revert "resolve #1292 ZMQ_IDENTITY_FD does not validate option_len"
This reverts commit 45c68154460b5cc828cb7ac027e5407776bff2ca.
This commit is contained in:
parent
45c6815446
commit
a450bdefec
@ -142,13 +142,7 @@ int zmq::router_t::xgetsockopt (int option_, const void *optval_,
|
||||
*optvallen_=sizeof(fd_t);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (optval_ && optvallen_ && *optvallen_) {
|
||||
if (*optvallen_ < sizeof(fd_t)) {
|
||||
*optvallen_=sizeof(fd_t);
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
blob_t identity= blob_t((unsigned char*)optval_,*optvallen_);
|
||||
outpipes_t::iterator it = outpipes.find (identity);
|
||||
if (it == outpipes.end() ){
|
||||
|
@ -61,18 +61,10 @@ int main (void)
|
||||
|
||||
//buffer for zmq_getsockopt / ZMQ_IDENTITY_FD
|
||||
char idbuf[255];
|
||||
char failbuf[2];
|
||||
size_t idbufsz=zmq_msg_size (&part);
|
||||
size_t failsz=2;
|
||||
|
||||
assert (idbufsz<=255);
|
||||
memcpy(idbuf,zmq_msg_data(&part),idbufsz);
|
||||
failbuf[0] = idbuf[0];
|
||||
failbuf[1] = 0;
|
||||
|
||||
// ensure that we validate buffer is sufficient to hold result
|
||||
rc = zmq_getsockopt (server, ZMQ_IDENTITY_FD, failbuf, &failsz);
|
||||
assert (rc == EINVAL);
|
||||
|
||||
rc = zmq_getsockopt (server, ZMQ_IDENTITY_FD, idbuf, &idbufsz);
|
||||
assert (rc == 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user