Skip to content

Commit 9556c4a

Browse files
committed
fixes requested in review
1 parent 772a102 commit 9556c4a

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

toxcore/group_chats.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4997,17 +4997,8 @@ static bool custom_gc_packet_length_is_valid(uint16_t length, bool lossless)
49974997
/** @brief Returns false if a custom incoming (non private) packet is too large. */
49984998
static bool custom_gc_incoming_non_private_packet_length_is_valid(uint16_t length, bool lossless)
49994999
{
5000-
if (lossless) {
5001-
if (length > MAX_GC_CUSTOM_LOSSLESS_INCOMING_ASSEMBLED_PACKET_SIZE) {
5002-
return false;
5003-
}
5004-
} else {
5005-
if (length > MAX_GC_CUSTOM_LOSSY_PACKET_SIZE) {
5006-
return false;
5007-
}
5008-
}
5009-
5010-
return true;
5000+
return lossless ? length <= MAX_GC_CUSTOM_LOSSLESS_INCOMING_ASSEMBLED_PACKET_SIZE
5001+
: length <= MAX_GC_CUSTOM_LOSSY_PACKET_SIZE;
50115002
}
50125003

50135004
int gc_send_custom_private_packet(const GC_Chat *chat, bool lossless, uint32_t peer_id, const uint8_t *message,

toxcore/group_common.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@
4545
/* Max size of a complete encrypted packet including headers. */
4646
#define MAX_GC_PACKET_SIZE (MAX_GC_PACKET_CHUNK_SIZE * 100)
4747

48-
/* allow incoming NGC custom packets that are non private to be up to the total max size of MAX_GC_PACKET_SIZE
49-
* which is 50000 bytes. the data itself can only be less than that because of NGC header overhead
48+
/* Allow incoming NGC custom packets that are non private to be up to the total max size of MAX_GC_PACKET_SIZE.
49+
* The data itself can only be less than that because of NGC header overhead
5050
*/
51-
#define MAX_GC_CUSTOM_LOSSLESS_INCOMING_ASSEMBLED_PACKET_SIZE MAX_GC_PACKET_SIZE
51+
#define MAX_GC_CUSTOM_LOSSLESS_INCOMING_ASSEMBLED_PACKET_SIZE MAX_GC_PACKET_SIZE
5252

5353

5454
/* Max number of messages to store in the send/recv arrays */

0 commit comments

Comments
 (0)