mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Messenger.c:
- unbroke Messenger_load(): lost a length adjustment - addeditional check for enough data available
This commit is contained in:
parent
513e37815d
commit
ef86109460
|
@ -1024,8 +1024,13 @@ int Messenger_load(Messenger *m, uint8_t *data, uint32_t length)
|
||||||
data += size;
|
data += size;
|
||||||
length -= size;
|
length -= size;
|
||||||
|
|
||||||
|
if (length < sizeof(size))
|
||||||
|
return -1;
|
||||||
|
|
||||||
memcpy(&size, data, sizeof(size));
|
memcpy(&size, data, sizeof(size));
|
||||||
data += sizeof(size);
|
data += sizeof(size);
|
||||||
|
length -= sizeof(size);
|
||||||
|
|
||||||
if (length < size)
|
if (length < size)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user