Fix coverity CID #1465797 - Negative loop bound in collect_deserializer
authorShane Lontis <shane.lontis@oracle.com>
Tue, 11 Aug 2020 05:17:17 +0000 (15:17 +1000)
committerShane Lontis <shane.lontis@oracle.com>
Mon, 24 Aug 2020 01:19:28 +0000 (11:19 +1000)
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/12628)

crypto/encode_decode/decoder_pkey.c

index 7f468c247685990bb8efbbf623c93b2c903277ef..e04b94de863fe5d2f0c986e29d66aab40b887c4e 100644 (file)
@@ -289,6 +289,8 @@ static void collect_decoder(OSSL_DECODER *decoder, void *arg)
         return;
 
     data->error_occured = 1;         /* Assume the worst */
+    if (data->names == NULL)
+        return;
 
     end_i = sk_OPENSSL_CSTRING_num(data->names);
     for (i = 0; i < end_i; i++) {