From b3dfe28be4924b912b29479c39d9a19160ff659d Mon Sep 17 00:00:00 2001 From: jwang Date: Mon, 27 Aug 2018 13:28:11 -0700 Subject: [PATCH] adding int overflow checks to vrefbuffer --- src/vrefbuffer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vrefbuffer.c b/src/vrefbuffer.c index 4734b0ff..46bb00fd 100644 --- a/src/vrefbuffer.c +++ b/src/vrefbuffer.c @@ -171,12 +171,13 @@ int msgpack_vrefbuffer_append_copy(msgpack_vrefbuffer* vbuf, int msgpack_vrefbuffer_migrate(msgpack_vrefbuffer* vbuf, msgpack_vrefbuffer* to) { size_t sz = vbuf->chunk_size; + msgpack_vrefbuffer_chunk* empty = NULL; if((sizeof(msgpack_vrefbuffer_chunk) + sz) < sz){ return -1; } - msgpack_vrefbuffer_chunk* empty = (msgpack_vrefbuffer_chunk*)malloc( + empty = (msgpack_vrefbuffer_chunk*)malloc( sizeof(msgpack_vrefbuffer_chunk) + sz); if(empty == NULL) { return -1;