Skip to content

Commit 464cf74

Browse files
committed
RTPStream: Add protection for bad input
If min_rtp_port is 0 and max_rtp_port is -2147483648, we try to bind to port 0. Fixes #771.
1 parent 3a35cb8 commit 464cf74

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/rtpstream.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1876,7 +1876,7 @@ static int rtpstream_get_localport(int* rtpsocket, int* rtcpsocket)
18761876
/* create socket for rtcp - ignore any errors, we only bind so we
18771877
* won't send icmp-port-unreachable when rtcp arrives */
18781878
*rtcpsocket = socket(media_ip_is_ipv6?PF_INET6:PF_INET, SOCK_DGRAM, 0);
1879-
if (*rtcpsocket != -1) {
1879+
if (*rtcpsocket != -1 && port_number > 0) {
18801880
/* try to bind it to our preferred address */
18811881
sockaddr_update_port(&address, port_number + 1);
18821882
if (::bind(*rtcpsocket, (sockaddr *) (void *)&address,

0 commit comments

Comments
 (0)