Skip to content

Commit

Permalink
feat: allow the large custom NGC packets to be handled also by the cl…
Browse files Browse the repository at this point in the history
…ient
  • Loading branch information
zoff99 committed Jan 24, 2024
1 parent 6370d0f commit 80ac793
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion other/bootstrap_daemon/docker/tox-bootstrapd.sha256
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9190d56ef3b346bc1632e6d7ee5fe5362be661bff58f2d6d88b5c1d1827394cd /usr/local/bin/tox-bootstrapd
cbc0080745e6606a0267be2e39cf56366010512be7e8167afe0dfad176441c7a /usr/local/bin/tox-bootstrapd
10 changes: 8 additions & 2 deletions toxcore/group_chats.c
Original file line number Diff line number Diff line change
Expand Up @@ -5118,8 +5118,14 @@ non_null(1, 2, 3, 4) nullable(7)
static int handle_gc_custom_packet(const GC_Session *c, const GC_Chat *chat, const GC_Peer *peer, const uint8_t *data,
uint16_t length, bool lossless, void *userdata)
{
if (!custom_gc_packet_length_is_valid(length, lossless)) {
return -1;
if (lossless) {
if (length > MAX_GC_CUSTOM_LOSSLESS_INCOMING_ASSEMBLED_PACKET_SIZE) {
return -1;

Check warning on line 5123 in toxcore/group_chats.c

View check run for this annotation

Codecov / codecov/patch

toxcore/group_chats.c#L5123

Added line #L5123 was not covered by tests
}
} else {
if (length > MAX_GC_CUSTOM_LOSSY_PACKET_SIZE) {
return -1;

Check warning on line 5127 in toxcore/group_chats.c

View check run for this annotation

Codecov / codecov/patch

toxcore/group_chats.c#L5127

Added line #L5127 was not covered by tests
}
}

if (data == nullptr || length == 0) {
Expand Down
6 changes: 6 additions & 0 deletions toxcore/group_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@
/* 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 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


/* Max number of messages to store in the send/recv arrays */
#define GCC_BUFFER_SIZE 8192

Expand Down

0 comments on commit 80ac793

Please sign in to comment.