fix: don't pass garbage data buffer to packet send functions

This garbage data was never looked at due to passing
a zero length along with it, but it's still undesirable.
This commit is contained in:
jfreegman 2024-01-10 12:37:21 -05:00
parent 32b68cffca
commit ebc9643862
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
2 changed files with 9 additions and 8 deletions

View File

@ -1 +1 @@
d5061af781d04d17bf26174c129b6149e0c8a120ef41133a51a8a7cc5e571e37 /usr/local/bin/tox-bootstrapd
a8e6d6d075090f4e6d27f59dd2e859a152948b3fac7f0b073386172339ec5d8d /usr/local/bin/tox-bootstrapd

View File

@ -2107,16 +2107,17 @@ static int handle_gc_tcp_relays(GC_Chat *chat, GC_Connection *gconn, const uint8
non_null()
static bool send_gc_invite_request(const GC_Chat *chat, GC_Connection *gconn)
{
uint16_t length = 0;
if (!chat_is_password_protected(chat)) {
return send_lossless_group_packet(chat, gconn, nullptr, 0, GP_INVITE_REQUEST);
}
uint8_t data[sizeof(uint16_t) + MAX_GC_PASSWORD_SIZE];
if (chat_is_password_protected(chat)) {
net_pack_u16(data, chat->shared_state.password_length);
length += sizeof(uint16_t);
uint16_t length = sizeof(uint16_t);
memcpy(data + length, chat->shared_state.password, MAX_GC_PASSWORD_SIZE);
length += MAX_GC_PASSWORD_SIZE;
}
return send_lossless_group_packet(chat, gconn, data, length, GP_INVITE_REQUEST);
}