Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(472)

Unified Diff: webrtc/p2p/base/relayserver.cc

Issue 1848083002: Change the size of the ICE ufrag to 4 bytes (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/p2p/base/relayserver.cc
diff --git a/webrtc/p2p/base/relayserver.cc b/webrtc/p2p/base/relayserver.cc
index e098cbcd843b5f5e0d99c2513a9e3dd7c5d704d8..37b3371bf753f25446891bb6c66ffaa30aa46cbf 100644
--- a/webrtc/p2p/base/relayserver.cc
+++ b/webrtc/p2p/base/relayserver.cc
@@ -26,9 +26,6 @@ namespace cricket {
// By default, we require a ping every 90 seconds.
const int MAX_LIFETIME = 15 * 60 * 1000;
-// The number of bytes in each of the usernames we use.
-const uint32_t USERNAME_LENGTH = 16;
-
// Calls SendTo on the given socket and logs any bad results.
void Send(rtc::AsyncPacketSocket* socket, const char* bytes, size_t size,
const rtc::SocketAddress& addr) {
@@ -263,11 +260,14 @@ void RelayServer::OnExternalPacket(
return;
}
- uint32_t length =
- std::min(static_cast<uint32_t>(username_attr->length()), USERNAME_LENGTH);
+ uint32_t length = static_cast<uint32_t>(username_attr->length());
std::string username(username_attr->bytes(), length);
+ // The username is the substring before colon in username_attr
+ std::string::size_type colonpos = username.find(':');
+ if (colonpos != std::string::npos) {
+ username = username.substr(0, colonpos);
+ }
// TODO: Check the HMAC.
-
// The binding should already be present.
BindingMap::iterator biter = bindings_.find(username);
if (biter == bindings_.end()) {

Powered by Google App Engine
This is Rietveld 408576698