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

Unified Diff: net/socket/ssl_client_socket_openssl.cc

Issue 862133002: Update from https://crrev.com/312398 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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: net/socket/ssl_client_socket_openssl.cc
diff --git a/net/socket/ssl_client_socket_openssl.cc b/net/socket/ssl_client_socket_openssl.cc
index a78a7cf4ed3a486d1cdc650dd6cb9f8444f7129a..504b702dc6614734df3894fb004168d4f6dad581 100644
--- a/net/socket/ssl_client_socket_openssl.cc
+++ b/net/socket/ssl_client_socket_openssl.cc
@@ -11,6 +11,7 @@
#include <openssl/bio.h>
#include <openssl/err.h>
#include <openssl/ssl.h>
+#include <string.h>
#include "base/bind.h"
#include "base/callback_helpers.h"
@@ -1900,9 +1901,10 @@ int SSLClientSocketOpenSSL::SelectNextProtoCallback(unsigned char** out,
// If we didn't find a protocol, we select the first one from our list.
if (npn_status_ == kNextProtoNoOverlap) {
- const std::string proto = NextProtoToString(ssl_config_.next_protos[0]);
- *out = reinterpret_cast<uint8*>(const_cast<char*>(proto.data()));
- *outlen = proto.size();
+ // NextProtoToString returns a pointer to a static string.
+ const char* proto = NextProtoToString(ssl_config_.next_protos[0]);
+ *out = reinterpret_cast<unsigned char*>(const_cast<char*>(proto));
+ *outlen = strlen(proto);
}
npn_proto_.assign(reinterpret_cast<const char*>(*out), *outlen);

Powered by Google App Engine
This is Rietveld 408576698