Skip to content

Commit a7b3711

Browse files
authored
[core] Fixed nonchecked empty config for packetfilter (#3031).
1 parent 7a4f5e2 commit a7b3711

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

srtcore/common.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,8 @@ bool SrtParseConfig(const string& s, SrtConfig& w_config)
446446

447447
vector<string> parts;
448448
Split(s, ',', back_inserter(parts));
449+
if (parts.empty())
450+
return false;
449451

450452
w_config.type = parts[0];
451453

test/test_fec_rebuilding.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,9 @@ TEST(TestFEC, ConfigExchange)
222222

223223
char fec_config1 [] = "fec,cols:10,rows:10";
224224

225-
srt_setsockflag(sid1, SRTO_PACKETFILTER, fec_config1, (sizeof fec_config1)-1);
225+
// Check empty configuration first
226+
EXPECT_EQ(srt_setsockflag(sid1, SRTO_PACKETFILTER, "", 0), -1);
227+
EXPECT_NE(srt_setsockflag(sid1, SRTO_PACKETFILTER, fec_config1, (sizeof fec_config1)-1), -1);
226228

227229
EXPECT_TRUE(m1.checkApplyFilterConfig("fec,cols:10,arq:never"));
228230

0 commit comments

Comments
 (0)