Problem: zmq_poller_destroy parameter checking

Solution:
- Add checks for **poller_p_ to ensure that we do not segfault when either it
  or the value within it are NULL
- Add tests for the above and increase error state coverage
This commit is contained in:
hitstergtd
2016-05-12 18:09:59 +01:00
parent f8c93d508f
commit 477cc1cb12
2 changed files with 12 additions and 3 deletions

View File

@@ -1110,8 +1110,9 @@ void *zmq_poller_new (void)
int zmq_poller_destroy (void **poller_p_)
{
void *poller = *poller_p_;
if (!poller || !((zmq::socket_poller_t*) poller)->check_tag ()) {
void *poller;
if (!poller_p_ || !(poller = *poller_p_) ||
!((zmq::socket_poller_t*) poller)->check_tag ()) {
errno = EFAULT;
return -1;
}