diff --git a/src/rtp/audio_decoders.cpp b/src/rtp/audio_decoders.cpp index 499ad0299..060d62edf 100644 --- a/src/rtp/audio_decoders.cpp +++ b/src/rtp/audio_decoders.cpp @@ -683,7 +683,7 @@ int decode_audio_frame(struct coded_data *cdata, void *pbuf_data, struct pbuf_st } unsigned int length; - char plaintext[cdata->data->data_len]; // plaintext will be actually shorter + char plaintext[RTP_MAX_PACKET_LEN]; // plaintext will be actually shorter size_t main_hdr_len = PT_AUDIO_HAS_FEC(pt) ? sizeof(fec_payload_hdr_t) : sizeof(audio_payload_hdr_t); if (PT_AUDIO_IS_ENCRYPTED(pt)) { uint32_t encryption_hdr = ntohl(*(uint32_t *)(void *) (cdata->data->data + main_hdr_len)); diff --git a/src/rtp/video_decoders.cpp b/src/rtp/video_decoders.cpp index acf097725..53081065f 100644 --- a/src/rtp/video_decoders.cpp +++ b/src/rtp/video_decoders.cpp @@ -1608,7 +1608,7 @@ int decode_video_frame(struct coded_data *cdata, void *decoder_data, struct pbuf goto cleanup; } - char plaintext[len]; // will be actually shorter + char plaintext[RTP_MAX_PACKET_LEN]; // will be actually shorter if (PT_VIDEO_IS_ENCRYPTED(pt)) { int data_len; diff --git a/src/transmit.cpp b/src/transmit.cpp index d617379ee..4d87682c9 100644 --- a/src/transmit.cpp +++ b/src/transmit.cpp @@ -716,7 +716,7 @@ tx_send_base(struct tx *tx, struct video_frame *frame, struct rtp *rtp_session, char *data = tile->data + ntohl(rtp_hdr_packet[1]); int data_len = packet_sizes.at(i % packet_sizes.size()); - char encrypted_data[data_len + MAX_CRYPTO_EXCEED]; + char encrypted_data[RTP_MAX_PACKET_LEN + MAX_CRYPTO_EXCEED]; if (tx->encryption != nullptr) { data_len = tx->enc_funcs->encrypt( tx->encryption, data, data_len, @@ -851,7 +851,7 @@ audio_tx_send_chan(struct tx *tx, struct rtp *rtp_session, uint32_t timestamp, rtp_hdr[1] = htonl(pos); pos += data_len; - char encrypted_data[data_len + MAX_CRYPTO_EXCEED]; + char encrypted_data[RTP_MAX_PACKET_LEN + MAX_CRYPTO_EXCEED]; if (tx->encryption) { data_len = tx->enc_funcs->encrypt( tx->encryption, const_cast(data), data_len,