adding int overflow checks to vrefbuffer

This commit is contained in:
jwang 2018-08-27 13:28:11 -07:00 committed by tbeu
parent e703d8a2f7
commit b3dfe28be4

View File

@ -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;