Przeglądaj źródła

e_loader_attic.c: Improve result handling of file_load_try_decode()

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/4930)
Dr. David von Oheimb 4 lat temu
rodzic
commit
09afbec94b
1 zmienionych plików z 4 dodań i 1 usunięć
  1. 4 1
      engines/e_loader_attic.c

+ 4 - 1
engines/e_loader_attic.c

@@ -1233,10 +1233,13 @@ static OSSL_STORE_INFO *file_load_try_decode(OSSL_STORE_LOADER_CTX *ctx,
                 }
                 if (result == NULL)
                     result = tmp_result;
+                if (result == NULL) /* e.g., PKCS#12 file decryption error */
+                    break;
             }
         }
 
-        if (*matchcount == 1 && matching_handlers[0]->repeatable) {
+        if (result != NULL
+                && *matchcount == 1 && matching_handlers[0]->repeatable) {
             ctx->_.file.last_handler = matching_handlers[0];
             ctx->_.file.last_handler_ctx = handler_ctx;
         }