Commit 0dbff625 authored by Andreas Huber's avatar Andreas Huber Committed by Gerrit Code Review
Browse files

Merge "Fix overflow of rand in ARTPConnection"

parents 628a8c0e be21e039
......@@ -117,7 +117,8 @@ void ARTPConnection::MakePortPair(
bumpSocketBufferSize(*rtcpSocket);
unsigned start = (rand() * 1000)/ RAND_MAX + 15550;
/* rand() * 1000 may overflow int type, use long long */
unsigned start = (unsigned)((rand()* 1000ll)/RAND_MAX) + 15550;
start &= ~1;
for (unsigned port = start; port < 65536; port += 2) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment