Skip to content

Commit

Permalink
[core] SRTO_FC: reject values lower than 32
Browse files Browse the repository at this point in the history
  • Loading branch information
maxsharabayko committed Apr 9, 2021
1 parent 81d3b95 commit 4849c3c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions srtcore/socketconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,15 @@ struct CSrtConfigSetter<SRTO_FC>
{
static void set(CSrtConfig& co, const void* optval, int optlen)
{
int fc = cast_optval<int>(optval, optlen);
if (fc < 1)
using namespace srt_logging;
const int fc = cast_optval<int>(optval, optlen);
if (fc < co.DEF_MIN_FLIGHT_PKT)
{
LOGC(kmlog.Error, log << "SRTO_FC: minimum allowed value is 32 (provided: " << fc << ")");
throw CUDTException(MJ_NOTSUP, MN_INVAL);
}

co.iFlightFlagSize = std::max(fc, +co.DEF_MIN_FLIGHT_PKT);
co.iFlightFlagSize = fc;
}
};

Expand Down

0 comments on commit 4849c3c

Please sign in to comment.