summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2012-02-16 10:29:16 +0900
committerMartin Sustrik <sustrik@250bpm.com>2012-02-16 10:29:16 +0900
commit15e10c3d3b012342562035aa3c08ecc1cfd42c69 (patch)
tree7b99001a1fd80e541e9a0870cb7b589a845fc47d
parent9521fefed1fffde0e0209c5c378842b0de888304 (diff)
Some additional parameter checking for ZMQ_(UN)SUBSCRIBE
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
-rw-r--r--src/sub.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/sub.cpp b/src/sub.cpp
index ad55ea3..94bb20d 100644
--- a/src/sub.cpp
+++ b/src/sub.cpp
@@ -44,6 +44,11 @@ int xs::sub_t::xsetsockopt (int option_, const void *optval_,
return -1;
}
+ if (optvallen_ > 0 && !optval_) {
+ errno = EFAULT;
+ return -1;
+ }
+
// Create the subscription message.
msg_t msg;
int rc = msg.init_size (optvallen_ + 1);