From 79b898ff34266eda582251f496884897035a8bd5 Mon Sep 17 00:00:00 2001 From: Youenn Piolet Date: Mon, 19 Aug 2019 15:42:01 +0200 Subject: [PATCH] Fix system priviledged port range, excluding port 1024 that is not reserved. (#812) --- ATTIC/srt-multiplex.cpp | 4 ++-- apps/transmitmedia.cpp | 8 ++++---- examples/suflip.cpp | 2 +- testing/srt-test-multiplex.cpp | 4 ++-- testing/testmedia.cpp | 8 ++++---- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ATTIC/srt-multiplex.cpp b/ATTIC/srt-multiplex.cpp index e95e8755d..fab40a093 100644 --- a/ATTIC/srt-multiplex.cpp +++ b/ATTIC/srt-multiplex.cpp @@ -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; } diff --git a/apps/transmitmedia.cpp b/apps/transmitmedia.cpp index 2b18479d6..749bf4cb2 100644 --- a/apps/transmitmedia.cpp +++ b/apps/transmitmedia.cpp @@ -1213,9 +1213,9 @@ extern unique_ptr 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(u.host(), iport, u.parameters()) ); @@ -1224,9 +1224,9 @@ extern unique_ptr 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(u.host(), iport, u.parameters()) ); diff --git a/examples/suflip.cpp b/examples/suflip.cpp index 6dfe75ca8..6a3ac41f2 100644 --- a/examples/suflip.cpp +++ b/examples/suflip.cpp @@ -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; } diff --git a/testing/srt-test-multiplex.cpp b/testing/srt-test-multiplex.cpp index a90ad9c97..2f194a1fd 100644 --- a/testing/srt-test-multiplex.cpp +++ b/testing/srt-test-multiplex.cpp @@ -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; } diff --git a/testing/testmedia.cpp b/testing/testmedia.cpp index 662d5ab92..dadda6b79 100755 --- a/testing/testmedia.cpp +++ b/testing/testmedia.cpp @@ -1261,9 +1261,9 @@ extern unique_ptr 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(u.host(), iport, u.parameters()) ); @@ -1272,9 +1272,9 @@ extern unique_ptr 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(u.host(), iport, u.parameters()) );