From 15e10c3d3b012342562035aa3c08ecc1cfd42c69 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Thu, 16 Feb 2012 10:29:16 +0900 Subject: Some additional parameter checking for ZMQ_(UN)SUBSCRIBE Signed-off-by: Martin Sustrik --- src/sub.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') 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); -- cgit v1.2.3