Skip to content

Commit 4b2bfd3

Browse files
committed
fix: fixes requested in review
1 parent 1fce193 commit 4b2bfd3

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

toxcore/group_chats.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5023,17 +5023,7 @@ static bool custom_gc_packet_length_is_valid(uint16_t length, bool lossless)
50235023
/** @brief Returns false if a custom incoming (non private) packet is too large. */
50245024
static bool custom_gc_incoming_non_private_packet_length_is_valid(uint16_t length, bool lossless)
50255025
{
5026-
if (lossless) {
5027-
if (length > MAX_GC_CUSTOM_LOSSLESS_INCOMING_ASSEMBLED_PACKET_SIZE) {
5028-
return false;
5029-
}
5030-
} else {
5031-
if (length > MAX_GC_CUSTOM_LOSSY_PACKET_SIZE) {
5032-
return false;
5033-
}
5034-
}
5035-
5036-
return true;
5026+
return length <= (lossless ? MAX_GC_CUSTOM_LOSSLESS_INCOMING_ASSEMBLED_PACKET_SIZE : MAX_GC_CUSTOM_LOSSY_PACKET_SIZE);
50375027
}
50385028

50395029
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)