Skip to content

Commit

Permalink
Merge pull request #1489 from pijyoi/fix_1488
Browse files Browse the repository at this point in the history
fix #1488 Heap buffer overflow in decoder
  • Loading branch information
c-rack committed Jul 25, 2015
2 parents 7701a8f + 2182bc9 commit 0917ece
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/msg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0917ece

Please sign in to comment.