Skip to content

Commit

Permalink
Fix system priviledged port range, excluding port 1024 that is not re…
Browse files Browse the repository at this point in the history
…served. (Haivision#812)
  • Loading branch information
uZer authored and maxsharabayko committed Aug 19, 2019
1 parent 553b24a commit 79b898f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions ATTIC/srt-multiplex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -566,9 +566,9 @@ int main( int argc, char** argv )
}

int iport = atoi(up.port().c_str());
if ( iport <= 1024 )
if ( iport < 1024 )
{
cerr << "Port value invalid: " << iport << " - must be >1024\n";
cerr << "Port value invalid: " << iport << " - must be >=1024\n";
return 1;
}

Expand Down
8 changes: 4 additions & 4 deletions apps/transmitmedia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1213,9 +1213,9 @@ extern unique_ptr<Base> CreateMedium(const string& uri)

case UriParser::SRT:
iport = atoi(u.port().c_str());
if ( iport <= 1024 )
if ( iport < 1024 )
{
cerr << "Port value invalid: " << iport << " - must be >1024\n";
cerr << "Port value invalid: " << iport << " - must be >=1024\n";
throw invalid_argument("Invalid port number");
}
ptr.reset( CreateSrt<Base>(u.host(), iport, u.parameters()) );
Expand All @@ -1224,9 +1224,9 @@ extern unique_ptr<Base> CreateMedium(const string& uri)

case UriParser::UDP:
iport = atoi(u.port().c_str());
if ( iport <= 1024 )
if ( iport < 1024 )
{
cerr << "Port value invalid: " << iport << " - must be >1024\n";
cerr << "Port value invalid: " << iport << " - must be >=1024\n";
throw invalid_argument("Invalid port number");
}
ptr.reset( CreateUdp<Base>(u.host(), iport, u.parameters()) );
Expand Down
2 changes: 1 addition & 1 deletion examples/suflip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ int main( int argc, char** argv )

if ( su.portno() < 1024 || tu.portno() < 1024 )
{
cerr << "Port number must be > 1024\n";
cerr << "Port number must be >= 1024\n";
return 1;
}

Expand Down
4 changes: 2 additions & 2 deletions testing/srt-test-multiplex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,9 +565,9 @@ int main( int argc, char** argv )
}

int iport = atoi(up.port().c_str());
if ( iport <= 1024 )
if ( iport < 1024 )
{
cerr << "Port value invalid: " << iport << " - must be >1024\n";
cerr << "Port value invalid: " << iport << " - must be >=1024\n";
return 1;
}

Expand Down
8 changes: 4 additions & 4 deletions testing/testmedia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1261,9 +1261,9 @@ extern unique_ptr<Base> CreateMedium(const string& uri)

case UriParser::SRT:
iport = atoi(u.port().c_str());
if ( iport <= 1024 )
if ( iport < 1024 )
{
cerr << "Port value invalid: " << iport << " - must be >1024\n";
cerr << "Port value invalid: " << iport << " - must be >=1024\n";
throw invalid_argument("Invalid port number");
}
ptr.reset( CreateSrt<Base>(u.host(), iport, u.parameters()) );
Expand All @@ -1272,9 +1272,9 @@ extern unique_ptr<Base> CreateMedium(const string& uri)

case UriParser::UDP:
iport = atoi(u.port().c_str());
if ( iport <= 1024 )
if ( iport < 1024 )
{
cerr << "Port value invalid: " << iport << " - must be >1024\n";
cerr << "Port value invalid: " << iport << " - must be >=1024\n";
throw invalid_argument("Invalid port number");
}
ptr.reset( CreateUdp<Base>(u.host(), iport, u.parameters()) );
Expand Down

0 comments on commit 79b898f

Please sign in to comment.