aboutsummaryrefslogtreecommitdiff
path: root/crypto/encode_decode/encoder_lib.c
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2024-06-20 23:24:17 +0000
committerEnji Cooper <ngie@FreeBSD.org>2024-06-20 23:24:17 +0000
commit1070e7dca8223387baf5155524b28f62bfe7da3c (patch)
treeeaa96223b0f6fd1e86ecd5165af26a4d85a3fff2 /crypto/encode_decode/encoder_lib.c
parent9dd13e84fa8eca8f3462bd55485aa3da8c37f54a (diff)
Diffstat (limited to 'crypto/encode_decode/encoder_lib.c')
-rw-r--r--crypto/encode_decode/encoder_lib.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/crypto/encode_decode/encoder_lib.c b/crypto/encode_decode/encoder_lib.c
index 7a55c7ab9a27..a88332b79d52 100644
--- a/crypto/encode_decode/encoder_lib.c
+++ b/crypto/encode_decode/encoder_lib.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -59,6 +59,11 @@ int OSSL_ENCODER_to_bio(OSSL_ENCODER_CTX *ctx, BIO *out)
return 0;
}
+ if (ctx->cleanup == NULL || ctx->construct == NULL) {
+ ERR_raise(ERR_LIB_OSSL_ENCODER, ERR_R_INIT_FAIL);
+ return 0;
+ }
+
return encoder_process(&data) > 0;
}