Skip to content

Commit

Permalink
[core] SRTO_CONGESTION: Check optlen in getsockopt
Browse files Browse the repository at this point in the history
  • Loading branch information
maxsharabayko committed Apr 15, 2021
1 parent 8c8d6fb commit f053394
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions srtcore/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,9 @@ void CUDT::getOpt(SRT_SOCKOPT optName, void *optval, int &optlen)
break;

case SRTO_CONGESTION:
if (size_t(optlen) < m_config.sCongestion.size() + 1)
throw CUDTException(MJ_NOTSUP, MN_INVAL, 0);

strcpy((char *)optval, m_config.sCongestion.c_str());
optlen = (int) m_config.sCongestion.size();
break;
Expand Down

0 comments on commit f053394

Please sign in to comment.