Skip to content

Commit 875f43c

Browse files
committed
Fix mixed-signed comparison in security code
1 parent 2a67b2d commit 875f43c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/core/tsi/ssl_transport_security.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,8 @@ static void tsi_ssl_handshaker_factory_init(
11221122
tsi_result tsi_ssl_get_cert_chain_contents(STACK_OF(X509) * peer_chain,
11231123
tsi_peer_property* property) {
11241124
BIO* bio = BIO_new(BIO_s_mem());
1125-
for (int i = 0; i < sk_X509_num(peer_chain); i++) {
1125+
const auto peer_chain_len = sk_X509_num(peer_chain);
1126+
for (auto i = decltype(peer_chain_len){0}; i < peer_chain_len; i++) {
11261127
if (!PEM_write_bio_X509(bio, sk_X509_value(peer_chain, i))) {
11271128
BIO_free(bio);
11281129
return TSI_INTERNAL_ERROR;

0 commit comments

Comments
 (0)