From 875f43c52f060f02a036cf01335809c6a80f7ef6 Mon Sep 17 00:00:00 2001 From: Mehrdad Afshari Date: Thu, 20 Feb 2020 10:53:55 -0800 Subject: [PATCH] Fix mixed-signed comparison in security code --- src/core/tsi/ssl_transport_security.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/tsi/ssl_transport_security.cc b/src/core/tsi/ssl_transport_security.cc index 69ba9e89ba2..02c278dad65 100644 --- a/src/core/tsi/ssl_transport_security.cc +++ b/src/core/tsi/ssl_transport_security.cc @@ -1122,7 +1122,8 @@ static void tsi_ssl_handshaker_factory_init( tsi_result tsi_ssl_get_cert_chain_contents(STACK_OF(X509) * peer_chain, tsi_peer_property* property) { BIO* bio = BIO_new(BIO_s_mem()); - for (int i = 0; i < sk_X509_num(peer_chain); i++) { + const auto peer_chain_len = sk_X509_num(peer_chain); + for (auto i = decltype(peer_chain_len){0}; i < peer_chain_len; i++) { if (!PEM_write_bio_X509(bio, sk_X509_value(peer_chain, i))) { BIO_free(bio); return TSI_INTERNAL_ERROR;