Skip to content

Commit

Permalink
fix: toxav rtp temp buffer allocation size was too large
Browse files Browse the repository at this point in the history
and cast from 32bit to 16bit, causing a overflow and making the
allocated size too small
  • Loading branch information
Green-Sky committed Sep 17, 2024
1 parent d369c93 commit 2ed3990
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion toxav/rtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ int rtp_send_data(RTPSession *session, const uint8_t *data, uint32_t length,
header.flags |= RTP_KEY_FRAME;
}

const uint16_t rdata_size = length + RTP_HEADER_SIZE + 1;
const uint16_t rdata_size = min_u32(length + RTP_HEADER_SIZE + 1, MAX_CRYPTO_DATA_SIZE);
VLA(uint8_t, rdata, rdata_size);
memset(rdata, 0, rdata_size);
rdata[0] = session->payload_type; // packet id == payload_type
Expand Down

0 comments on commit 2ed3990

Please sign in to comment.