Skip to content

Commit 453c268

Browse files
committed
fix: split up condition again
1 parent 5e5b50c commit 453c268

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

toxcore/group_chats.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5118,8 +5118,14 @@ non_null(1, 2, 3, 4) nullable(7)
51185118
static int handle_gc_custom_packet(const GC_Session *c, const GC_Chat *chat, const GC_Peer *peer, const uint8_t *data,
51195119
uint16_t length, bool lossless, void *userdata)
51205120
{
5121-
if (!(length <= (lossless ? MAX_GC_CUSTOM_LOSSLESS_INCOMING_ASSEMBLED_PACKET_SIZE : MAX_GC_CUSTOM_LOSSY_PACKET_SIZE))) {
5122-
return -1;
5121+
if (lossless) {
5122+
if (length > MAX_GC_CUSTOM_LOSSLESS_INCOMING_ASSEMBLED_PACKET_SIZE) {
5123+
return -1;
5124+
}
5125+
} else {
5126+
if (length > MAX_GC_CUSTOM_LOSSY_PACKET_SIZE) {
5127+
return -1;
5128+
}
51235129
}
51245130

51255131
if (data == nullptr || length == 0) {

0 commit comments

Comments
 (0)