srtp_hdr_xtnd_t *xtn_hdr = (srtp_hdr_xtnd_t*)enc_start;
enc_start += (ntohs(xtn_hdr->length) + 1);
}
+ if (!(enc_start < (uint32_t*)hdr + *pkt_octet_len))
+ return err_status_parse_err;
enc_octet_len = (unsigned int)(*pkt_octet_len -
((enc_start - (uint32_t*)hdr) << 2));
} else {
srtp_hdr_xtnd_t *xtn_hdr = (srtp_hdr_xtnd_t*)enc_start;
enc_start += (ntohs(xtn_hdr->length) + 1);
}
+ if (!(enc_start < (uint32_t*)hdr + *pkt_octet_len))
+ return err_status_parse_err;
/*
* We pass the tag down to the cipher when doing GCM mode
*/
if (hdr->x == 1) {
srtp_hdr_xtnd_t *xtn_hdr = (srtp_hdr_xtnd_t *)enc_start;
enc_start += (ntohs(xtn_hdr->length) + 1);
+ if (!(enc_start < (uint32_t*)hdr + *pkt_octet_len))
+ return err_status_parse_err;
}
enc_octet_len = (unsigned int)(*pkt_octet_len
- ((enc_start - (uint32_t *)hdr) << 2));
srtp_hdr_xtnd_t *xtn_hdr = (srtp_hdr_xtnd_t *)enc_start;
enc_start += (ntohs(xtn_hdr->length) + 1);
}
+ if (!(enc_start < (uint32_t*)hdr + *pkt_octet_len))
+ return err_status_parse_err;
enc_octet_len = (uint32_t)(*pkt_octet_len - tag_len
- ((enc_start - (uint32_t *)hdr) << 2));
} else {