Skip to content

Commit 8d02621

Browse files
committed
Add SDPMid constraint validation
1 parent 3e0220d commit 8d02621

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/app/clusters/webrtc-transport-provider-server/webrtc-transport-provider-server.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,15 @@ void WebRTCTransportProviderServer::HandleProvideICECandidates(HandlerContext &
709709
{
710710
// Get current candidate.
711711
const ICECandidateStruct & candidate = iter.GetValue();
712+
713+
// Validate SDPMid constraint: if present, must have min length 1
714+
if (!candidate.SDPMid.IsNull() && candidate.SDPMid.Value().size() == 0)
715+
{
716+
ChipLogError(Zcl, "HandleProvideICECandidates: SDPMid must have minimum length of 1 when present");
717+
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError);
718+
return;
719+
}
720+
712721
candidates.push_back(candidate);
713722
}
714723

src/app/clusters/webrtc-transport-requestor-server/webrtc-transport-requestor-cluster.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,14 @@ WebRTCTransportRequestorServer::HandleICECandidates(const CommandHandler & comma
260260
{
261261
// Get current candidate.
262262
const ICECandidateStruct & candidate = iter.GetValue();
263+
264+
// Validate SDPMid constraint: if present, must have min length 1
265+
if (!candidate.SDPMid.IsNull() && candidate.SDPMid.Value().size() == 0)
266+
{
267+
ChipLogError(Zcl, "HandleICECandidates: SDPMid must have minimum length of 1 when present");
268+
return Status::ConstraintError;
269+
}
270+
263271
candidates.push_back(candidate);
264272
}
265273

0 commit comments

Comments
 (0)