diff --git a/other/bootstrap_daemon/docker/tox-bootstrapd.sha256 b/other/bootstrap_daemon/docker/tox-bootstrapd.sha256 index 0f2faf44d1..0c2e67d517 100644 --- a/other/bootstrap_daemon/docker/tox-bootstrapd.sha256 +++ b/other/bootstrap_daemon/docker/tox-bootstrapd.sha256 @@ -1 +1 @@ -7dfcf534fb80fbd8337337f5aa9eaa120febc72386046c7ab0d5c7545e900657 /usr/local/bin/tox-bootstrapd +5c4a98ec31bd106717fe81804cd2f2edf04cb51f34ed73ad1513c82dce1f2a04 /usr/local/bin/tox-bootstrapd diff --git a/toxcore/group_chats.c b/toxcore/group_chats.c index 6dd942ba0f..ef4bda0345 100644 --- a/toxcore/group_chats.c +++ b/toxcore/group_chats.c @@ -5117,8 +5117,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; + } + } else { + if (length > MAX_GC_CUSTOM_LOSSY_PACKET_SIZE) { + return -1; + } } if (data == nullptr || length == 0) { diff --git a/toxcore/group_common.h b/toxcore/group_common.h index dbbd7441d1..e0af0fb9a0 100644 --- a/toxcore/group_common.h +++ b/toxcore/group_common.h @@ -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