Commit 0917eceb authored by Constantin Rack's avatar Constantin Rack

Merge pull request #1489 from pijyoi/fix_1488

fix #1488 Heap buffer overflow in decoder
parents 7701a8f9 2182bc96
......@@ -103,8 +103,9 @@ int zmq::msg_t::init_size (size_t size_)
u.lmsg.type = type_lmsg;
u.lmsg.flags = 0;
u.lmsg.routing_id = 0;
u.lmsg.content =
(content_t*) malloc (sizeof (content_t) + size_);
u.lmsg.content = NULL;
if (sizeof (content_t) + size_ > size_)
u.lmsg.content = (content_t*) malloc (sizeof (content_t) + size_);
if (unlikely (!u.lmsg.content)) {
errno = ENOMEM;
return -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment