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

Unified Diff: content/browser/devtools/protocol/network_handler.cc

Issue 2191243002: [DevTools] Fix text representation of IP addresses in SAN certificates (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change cast type Created 4 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/devtools/protocol/network_handler.cc
diff --git a/content/browser/devtools/protocol/network_handler.cc b/content/browser/devtools/protocol/network_handler.cc
index ae9a58d7ce8a196e7ddc29895796a50a2c0ed3da..e41f27430ec0f90af4401c0ec96b2a562eea0b53 100644
--- a/content/browser/devtools/protocol/network_handler.cc
+++ b/content/browser/devtools/protocol/network_handler.cc
@@ -316,14 +316,22 @@ Response NetworkHandler::GetCertificateDetails(
std::vector<std::string> ip_addrs;
cert->GetSubjectAltName(&dns_names, &ip_addrs);
+ // IP addresses are in raw network bytes and must be converted to string form
+ std::vector<std::string> ip_addrs_string;
+ for (const std::string& ip : ip_addrs) {
+ net::IPAddress ip_addr(reinterpret_cast<const uint8_t*>(ip.c_str()),
+ ip.length());
+ ip_addrs_string.push_back(ip_addr.ToString());
+ }
+
*result = CertificateDetails::Create()
- ->set_subject(CertificateSubject::Create()
+ ->set_subject(CertificateSubject::Create()
->set_name(name)
->set_san_dns_names(dns_names)
- ->set_san_ip_addresses(ip_addrs))
- ->set_issuer(issuer)
- ->set_valid_from(valid_from.ToDoubleT())
- ->set_valid_to(valid_to.ToDoubleT());
+ ->set_san_ip_addresses(ip_addrs_string))
+ ->set_issuer(issuer)
+ ->set_valid_from(valid_from.ToDoubleT())
+ ->set_valid_to(valid_to.ToDoubleT());
return Response::OK();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698