Skip to content

Commit

Permalink
check for capacity overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
jmillan committed Jan 17, 2024
1 parent 16ae11e commit e23bd13
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions srtp/srtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -4910,6 +4910,12 @@ srtp_err_status_t srtp_stream_list_insert(srtp_stream_list_t list,
*/
if (list->size == list->capacity) {
size_t new_capacity = list->capacity + ((list->capacity + 1u) / 2u);

// check for capacity overflow.
if (new_capacity <= list->capacity) {
return srtp_err_status_alloc_fail;
}

list_entry *new_entries =
srtp_crypto_alloc(sizeof(list_entry) * new_capacity);
if (new_entries == NULL) {
Expand Down

0 comments on commit e23bd13

Please sign in to comment.