Fix Coverity 1503218: negative loop bound
authorPauli <pauli@openssl.org>
Thu, 24 Mar 2022 03:31:19 +0000 (14:31 +1100)
committerPauli <pauli@openssl.org>
Sat, 26 Mar 2022 03:31:21 +0000 (14:31 +1100)
commit0bcae9893b99666158dd8b35fb674e6188b0b5c3
tree0a9d93b696552dafcddabf7f31b820d7e9e7a237
parent0089cc7f9d42f6e39872161199fb8b6a99da2492
Fix Coverity 1503218: negative loop bound

OPENSSL_sk_num returns an integer which can theoretically be negative.
Assigning this to a size_t and using it as a loop bound isn't ideal.

Rather than adding checked for NULL or negative returns, changing the loop
index and end to int is simpler.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17954)
crypto/encode_decode/decoder_pkey.c