From 4db73fc18bef4096100de9b04eca961d3fb996ac Mon Sep 17 00:00:00 2001 From: Pieter Hintjens Date: Fri, 11 Sep 2015 17:09:24 -0400 Subject: [PATCH] Problem: msg.cpp:set_routing_id accepts a zero routing ID Solution: check/reject a zero routing ID with EINVAL. --- src/msg.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/msg.cpp b/src/msg.cpp index edf0910d..e3a1dccb 100644 --- a/src/msg.cpp +++ b/src/msg.cpp @@ -504,8 +504,12 @@ uint32_t zmq::msg_t::get_routing_id () int zmq::msg_t::set_routing_id (uint32_t routing_id_) { - u.base.routing_id = routing_id_; - return 0; + if (routing_id_) { + u.base.routing_id = routing_id_; + return 0; + } + errno = EINVAL; + return -1; } zmq::atomic_counter_t *zmq::msg_t::refcnt()