mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-06-26 14:34:02 +02:00
adding int overflow checks to vrefbuffer
This commit is contained in:
parent
e703d8a2f7
commit
b3dfe28be4
@ -171,12 +171,13 @@ int msgpack_vrefbuffer_append_copy(msgpack_vrefbuffer* vbuf,
|
|||||||
int msgpack_vrefbuffer_migrate(msgpack_vrefbuffer* vbuf, msgpack_vrefbuffer* to)
|
int msgpack_vrefbuffer_migrate(msgpack_vrefbuffer* vbuf, msgpack_vrefbuffer* to)
|
||||||
{
|
{
|
||||||
size_t sz = vbuf->chunk_size;
|
size_t sz = vbuf->chunk_size;
|
||||||
|
msgpack_vrefbuffer_chunk* empty = NULL;
|
||||||
|
|
||||||
if((sizeof(msgpack_vrefbuffer_chunk) + sz) < sz){
|
if((sizeof(msgpack_vrefbuffer_chunk) + sz) < sz){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
msgpack_vrefbuffer_chunk* empty = (msgpack_vrefbuffer_chunk*)malloc(
|
empty = (msgpack_vrefbuffer_chunk*)malloc(
|
||||||
sizeof(msgpack_vrefbuffer_chunk) + sz);
|
sizeof(msgpack_vrefbuffer_chunk) + sz);
|
||||||
if(empty == NULL) {
|
if(empty == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user