mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Added minor error checking in Core, this helps prevent CERT MEM04-C; CWE-131
This commit is contained in:
parent
71bc275284
commit
17d3878174
@ -37,8 +37,9 @@ static int write_cryptpacket_id(Messenger *m, int friendnumber, uint8_t packet_i
|
||||
return -1 if realloc fails */
|
||||
int realloc_friendlist(Messenger *m, uint32_t num)
|
||||
{
|
||||
if (num * sizeof(Friend) == 0) return -1;
|
||||
|
||||
Friend *newfriendlist = realloc(m->friendlist, num * sizeof(Friend));
|
||||
|
||||
if (newfriendlist == NULL && num != 0)
|
||||
return -1;
|
||||
|
||||
@ -597,7 +598,6 @@ int write_cryptpacket_id(Messenger *m, int friendnumber, uint8_t packet_id, uint
|
||||
|
||||
/*Interval in seconds between LAN discovery packet sending*/
|
||||
#define LAN_DISCOVERY_INTERVAL 60
|
||||
|
||||
#define PORT 33445
|
||||
|
||||
/*Send a LAN discovery packet every LAN_DISCOVERY_INTERVAL seconds*/
|
||||
@ -971,4 +971,3 @@ int Messenger_load(Messenger *m, uint8_t *data, uint32_t length)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user