Skip to content

Commit

Permalink
fix: fixes requested in review
Browse files Browse the repository at this point in the history
  • Loading branch information
zoff99 committed Jan 19, 2024
1 parent bd02e13 commit d60aa5a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
12 changes: 1 addition & 11 deletions toxcore/group_chats.c
Original file line number Diff line number Diff line change
Expand Up @@ -5023,17 +5023,7 @@ static bool custom_gc_packet_length_is_valid(uint16_t length, bool lossless)
/** @brief Returns false if a custom incoming (non private) packet is too large. */
static bool custom_gc_incoming_non_private_packet_length_is_valid(uint16_t length, bool lossless)
{
if (lossless) {
if (length > MAX_GC_CUSTOM_LOSSLESS_INCOMING_ASSEMBLED_PACKET_SIZE) {
return false;
}
} else {
if (length > MAX_GC_CUSTOM_LOSSY_PACKET_SIZE) {
return false;
}
}

return true;
return length <= (lossless ? MAX_GC_CUSTOM_LOSSLESS_INCOMING_ASSEMBLED_PACKET_SIZE : MAX_GC_CUSTOM_LOSSY_PACKET_SIZE);
}

int gc_send_custom_private_packet(const GC_Chat *chat, bool lossless, uint32_t peer_id, const uint8_t *message,
Expand Down
6 changes: 3 additions & 3 deletions toxcore/group_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
/* Max size of a complete encrypted packet including headers. */
#define MAX_GC_PACKET_SIZE (MAX_GC_PACKET_CHUNK_SIZE * 100)

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


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

0 comments on commit d60aa5a

Please sign in to comment.