Skip to content

Commit

Permalink
RTPStream: Add protection for bad input
Browse files Browse the repository at this point in the history
If min_rtp_port is 0 and max_rtp_port is -2147483648, we try to bind to
port 0.

Fixes #771.
  • Loading branch information
orgads committed Jan 22, 2025
1 parent 3a35cb8 commit 464cf74
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/rtpstream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1876,7 +1876,7 @@ static int rtpstream_get_localport(int* rtpsocket, int* rtcpsocket)
/* create socket for rtcp - ignore any errors, we only bind so we
* won't send icmp-port-unreachable when rtcp arrives */
*rtcpsocket = socket(media_ip_is_ipv6?PF_INET6:PF_INET, SOCK_DGRAM, 0);
if (*rtcpsocket != -1) {
if (*rtcpsocket != -1 && port_number > 0) {
/* try to bind it to our preferred address */
sockaddr_update_port(&address, port_number + 1);
if (::bind(*rtcpsocket, (sockaddr *) (void *)&address,
Expand Down

0 comments on commit 464cf74

Please sign in to comment.