summaryrefslogtreecommitdiffstats
path: root/providers/implementations/storemgmt/file_store_der2obj.c
diff options
context:
space:
mode:
Diffstat (limited to 'providers/implementations/storemgmt/file_store_der2obj.c')
-rw-r--r--providers/implementations/storemgmt/file_store_der2obj.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/providers/implementations/storemgmt/file_store_der2obj.c b/providers/implementations/storemgmt/file_store_der2obj.c
index 74a18eb70b..d34e90540d 100644
--- a/providers/implementations/storemgmt/file_store_der2obj.c
+++ b/providers/implementations/storemgmt/file_store_der2obj.c
@@ -85,10 +85,13 @@ static int der2obj_decode(void *provctx, OSSL_CORE_BIO *cin, int selection,
* We're called from file_store.c, so we know that OSSL_CORE_BIO is a
* BIO in this case.
*/
- BIO *in = (BIO *)cin;
+ BIO *in = bio_new_from_core_bio(provctx, cin);
BUF_MEM *mem = NULL;
int err, ok;
+ if (in == NULL)
+ return 0;
+
ERR_set_mark();
ok = (asn1_d2i_read_bio(in, &mem) >= 0);
/*
@@ -117,6 +120,7 @@ static int der2obj_decode(void *provctx, OSSL_CORE_BIO *cin, int selection,
OPENSSL_free(mem->data);
OPENSSL_free(mem);
}
+ BIO_free(in);
return ok;
}