Skip to content

Commit b3dfe28

Browse files
jwangtbeu
authored andcommitted
adding int overflow checks to vrefbuffer
1 parent e703d8a commit b3dfe28

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/vrefbuffer.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,13 @@ int msgpack_vrefbuffer_append_copy(msgpack_vrefbuffer* vbuf,
171171
int msgpack_vrefbuffer_migrate(msgpack_vrefbuffer* vbuf, msgpack_vrefbuffer* to)
172172
{
173173
size_t sz = vbuf->chunk_size;
174+
msgpack_vrefbuffer_chunk* empty = NULL;
174175

175176
if((sizeof(msgpack_vrefbuffer_chunk) + sz) < sz){
176177
return -1;
177178
}
178179

179-
msgpack_vrefbuffer_chunk* empty = (msgpack_vrefbuffer_chunk*)malloc(
180+
empty = (msgpack_vrefbuffer_chunk*)malloc(
180181
sizeof(msgpack_vrefbuffer_chunk) + sz);
181182
if(empty == NULL) {
182183
return -1;

0 commit comments

Comments
 (0)