aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/core/tsi/ssl_transport_security.cc4
-rw-r--r--test/core/tsi/ssl_transport_security_test.cc6
2 files changed, 6 insertions, 4 deletions
diff --git a/src/core/tsi/ssl_transport_security.cc b/src/core/tsi/ssl_transport_security.cc
index 3ff3557286..d6a72ada0d 100644
--- a/src/core/tsi/ssl_transport_security.cc
+++ b/src/core/tsi/ssl_transport_security.cc
@@ -1051,9 +1051,9 @@ static tsi_result ssl_handshaker_result_extract_peer(
}
const char* session_reused = SSL_session_reused(impl->ssl) ? "true" : "false";
- result = tsi_construct_string_peer_property(
+ result = tsi_construct_string_peer_property_from_cstring(
TSI_SSL_SESSION_REUSED_PEER_PROPERTY, session_reused,
- strlen(session_reused) + 1, &peer->properties[peer->property_count]);
+ &peer->properties[peer->property_count]);
if (result != TSI_OK) return result;
peer->property_count++;
diff --git a/test/core/tsi/ssl_transport_security_test.cc b/test/core/tsi/ssl_transport_security_test.cc
index b477904d60..baffad6ea3 100644
--- a/test/core/tsi/ssl_transport_security_test.cc
+++ b/test/core/tsi/ssl_transport_security_test.cc
@@ -208,9 +208,11 @@ static void check_session_reusage(ssl_tsi_test_fixture* ssl_fixture,
tsi_peer_get_property_by_name(peer, TSI_SSL_SESSION_REUSED_PEER_PROPERTY);
GPR_ASSERT(session_reused != nullptr);
if (ssl_fixture->session_reused) {
- GPR_ASSERT(strcmp(session_reused->value.data, "true") == 0);
+ GPR_ASSERT(strncmp(session_reused->value.data, "true",
+ session_reused->value.length) == 0);
} else {
- GPR_ASSERT(strcmp(session_reused->value.data, "false") == 0);
+ GPR_ASSERT(strncmp(session_reused->value.data, "false",
+ session_reused->value.length) == 0);
}
}