Bug 1383814: throw exception for too long TURN username. r?mjf draft
authorNils Ohlmeier [:drno] <drno@ohlmeier.org>
Tue, 25 Jul 2017 15:47:27 -0700
changeset 615415 03c6c2358842078361b905713bc0578ddbe4089f
parent 615176 32d9d1e81cc607320a36391845917f645f7a7f72
child 639170 694faa79c1f41450fe219465b0575c5effb9abe8
push id70351
push userdrno@ohlmeier.org
push dateTue, 25 Jul 2017 22:48:51 +0000
reviewersmjf
bugs1383814
milestone56.0a1
Bug 1383814: throw exception for too long TURN username. r?mjf MozReview-Commit-ID: 2K9lU5Ycbny
dom/media/PeerConnection.js
--- a/dom/media/PeerConnection.js
+++ b/dom/media/PeerConnection.js
@@ -637,16 +637,21 @@ class RTCPeerConnection {
         throw new this._win.DOMException(msg + " - missing urls", "InvalidAccessError");
       }
       urls.map(url => nicerNewURI(url)).forEach(({ scheme, spec }) => {
         if (scheme in { turn: 1, turns: 1 }) {
           if (username == undefined) {
             throw new this._win.DOMException(msg + " - missing username: " + spec,
                                              "InvalidAccessError");
           }
+          if (username.length > 512) {
+            throw new this._win.DOMException(msg +
+                                             " - username longer then 512 bytes: "
+                                             + username, "InvalidAccessError");
+          }
           if (credential == undefined) {
             throw new this._win.DOMException(msg + " - missing credential: " + spec,
                                              "InvalidAccessError");
           }
           if (credentialType != "password") {
             this.logWarning("RTCConfiguration TURN credentialType \"" +
                             credentialType +
                             "\" is not yet implemented. Treating as password." +