Skip to content

Commit e23bd13

Browse files
committed
check for capacity overflow
1 parent 16ae11e commit e23bd13

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

srtp/srtp.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4910,6 +4910,12 @@ srtp_err_status_t srtp_stream_list_insert(srtp_stream_list_t list,
49104910
*/
49114911
if (list->size == list->capacity) {
49124912
size_t new_capacity = list->capacity + ((list->capacity + 1u) / 2u);
4913+
4914+
// check for capacity overflow.
4915+
if (new_capacity <= list->capacity) {
4916+
return srtp_err_status_alloc_fail;
4917+
}
4918+
49134919
list_entry *new_entries =
49144920
srtp_crypto_alloc(sizeof(list_entry) * new_capacity);
49154921
if (new_entries == NULL) {

0 commit comments

Comments
 (0)