summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2010-05-06 10:33:01 +0200
committerMartin Sustrik <sustrik@250bpm.com>2010-05-06 10:33:01 +0200
commitf60d891b2309cdc6f2cc1507a238cec85e4aa9e7 (patch)
tree24c2b3027a404fadc634cb53a2151385fe4eee16
parent64c58662b7f491f2a3c8cb684f27ea1d5c549552 (diff)
Issue 23. zmq_init() crashes on illegal numbers
-rw-r--r--src/zmq.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/zmq.cpp b/src/zmq.cpp
index ecb3d3d..fb7a7f9 100644
--- a/src/zmq.cpp
+++ b/src/zmq.cpp
@@ -230,7 +230,10 @@ size_t zmq_msg_size (zmq_msg_t *msg_)
// Reflect this in the API/ABI.
void *zmq_init (int /*app_threads_*/, int io_threads_, int /*flags_*/)
{
- // There are no context flags defined at the moment, so flags_ is ignored.
+ if (io_threads_ < 0) {
+ errno = EINVAL;
+ return NULL;
+ }
#if defined ZMQ_HAVE_OPENPGM
// Unfortunately, OpenPGM doesn't support refcounted init/shutdown, thus,