Added buffer overflow check in RLC UM reassemble

master
Ismael Gomez 7 years ago
parent 4753366096
commit f064b83183

@ -513,10 +513,19 @@ void rlc_um::reassemble_rx_sdus()
} }
// Handle last segment // Handle last segment
memcpy(&rx_sdu->msg[rx_sdu->N_bytes], rx_window[vr_ur].buf->msg, rx_window[vr_ur].buf->N_bytes); // Handle last segment
rx_sdu->N_bytes += rx_window[vr_ur].buf->N_bytes; if (rx_sdu->N_bytes < SRSLTE_MAX_BUFFER_SIZE_BYTES ||
log->debug("Writting last segment in SDU buffer. Updating vr_ur=%d, Buffer size=%d, segment size=%d\n", rx_window[vr_ur].buf->N_bytes < SRSLTE_MAX_BUFFER_SIZE_BYTES ||
vr_ur, rx_sdu->N_bytes, rx_window[vr_ur].buf->N_bytes); rx_window[vr_ur].buf->N_bytes + rx_sdu->N_bytes < SRSLTE_MAX_BUFFER_SIZE_BYTES) {
memcpy(&rx_sdu->msg[rx_sdu->N_bytes], rx_window[vr_ur].buf->msg, rx_window[vr_ur].buf->N_bytes);
rx_sdu->N_bytes += rx_window[vr_ur].buf->N_bytes;
log->debug("Writting last segment in SDU buffer. Updating vr_ur=%d, Buffer size=%d, segment size=%d\n",
vr_ur, rx_sdu->N_bytes, rx_window[vr_ur].buf->N_bytes);
} else {
log->error("Out of bounds while reassembling SDU buffer in UM: sdu_len=%d, window_buffer_len=%d, vr_ur=%d\n",
rx_sdu->N_bytes, rx_window[vr_ur].buf->N_bytes, vr_ur);
}
vr_ur_in_rx_sdu = vr_ur; vr_ur_in_rx_sdu = vr_ur;
if(rlc_um_end_aligned(rx_window[vr_ur].header.fi)) if(rlc_um_end_aligned(rx_window[vr_ur].header.fi))
{ {

Loading…
Cancel
Save