Skip to content

Commit

Permalink
fix: handle invalid m-line with trailing whitespace (#67)
Browse files Browse the repository at this point in the history
Co-authored-by: Bryce Tham <btham@cisco.com>
  • Loading branch information
brycetham and Bryce Tham committed Dec 12, 2023
1 parent cc3473b commit 6f4fbdb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/peer-connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ class PeerConnection extends EventEmitter<PeerConnectionEventHandlers> {
?.split(/(\r\n|\r|\n)/)
.filter((line) => line.startsWith('m'))
.forEach((mediaLine) => {
if (mediaLine.split(' ').length < 4) {
if (mediaLine.trim().split(' ').length < 4) {
throw new Error(`Invalid media line ${mediaLine}, expected at least 4 fields`);
}
});
Expand Down

0 comments on commit 6f4fbdb

Please sign in to comment.