Index: webrtc/pc/webrtcsdp.cc |
diff --git a/webrtc/pc/webrtcsdp.cc b/webrtc/pc/webrtcsdp.cc |
index 11eefe5c3d5098f88ce8a884c5535d7dd14248cf..4a190c7663654dcc24dd82c270c84c0bb68f360e 100644 |
--- a/webrtc/pc/webrtcsdp.cc |
+++ b/webrtc/pc/webrtcsdp.cc |
@@ -1026,6 +1026,9 @@ bool ParseCandidate(const std::string& message, Candidate* candidate, |
if (!GetValueFromString(first_line, fields[5], &port, error)) { |
return false; |
} |
+ if (port < 0 || port > 65535) { |
+ return ParseFailed(first_line, "Invalid port number.", error); |
+ } |
SocketAddress address(connection_address, port); |
cricket::ProtocolType protocol; |
@@ -1072,6 +1075,9 @@ bool ParseCandidate(const std::string& message, Candidate* candidate, |
first_line, fields[++current_position], &port, error)) { |
return false; |
} |
+ if (port < 0 || port > 65535) { |
pthatcher1
2017/02/10 18:13:33
Might as well make an IsValidPort() function.
Taylor Brandstetter
2017/02/10 19:25:30
Done.
|
+ return ParseFailed(first_line, "Invalid port number.", error); |
+ } |
related_address.SetPort(port); |
++current_position; |
} |