Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow the large custom NGC packets to be handled also by the client #2535

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
7dfcf534fb80fbd8337337f5aa9eaa120febc72386046c7ab0d5c7545e900657 /usr/local/bin/tox-bootstrapd
5c4a98ec31bd106717fe81804cd2f2edf04cb51f34ed73ad1513c82dce1f2a04 /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 @@ -5117,8 +5117,14 @@
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 5122 in toxcore/group_chats.c

View check run for this annotation

Codecov / codecov/patch

toxcore/group_chats.c#L5122

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

Check warning on line 5126 in toxcore/group_chats.c

View check run for this annotation

Codecov / codecov/patch

toxcore/group_chats.c#L5126

Added line #L5126 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
Loading