From 9728706b1036246952b538bac19ebe30afa9ac80 Mon Sep 17 00:00:00 2001 From: Pieter Hintjens Date: Thu, 29 Mar 2012 07:46:46 -0500 Subject: [PATCH] Added optval checking in zmq_ctx_set --- src/ctx.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ctx.cpp b/src/ctx.cpp index b2dd29af..520d2042 100644 --- a/src/ctx.cpp +++ b/src/ctx.cpp @@ -128,13 +128,13 @@ int zmq::ctx_t::terminate () int zmq::ctx_t::set (int option_, int optval_) { int rc = 0; - if (option_ == ZMQ_MAX_SOCKETS) { + if (option_ == ZMQ_MAX_SOCKETS && optval_ >= 1) { opt_sync.lock (); max_sockets = optval_; opt_sync.unlock (); } else - if (option_ == ZMQ_IO_THREADS) { + if (option_ == ZMQ_IO_THREADS && optval_ >= 0) { opt_sync.lock (); io_thread_count = optval_; opt_sync.unlock ();