diff options
author | Tomas Mraz <tomas@openssl.org> | 2022-03-28 19:13:22 +0200 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2022-11-21 10:49:51 +0100 |
commit | a48081ac606c7bbce5e3adad7ad2d6dfc1b4f215 (patch) | |
tree | 076a5ee6756280a4cad84d45274757bd43d25002 /crypto/params.c | |
parent | 8436ef8bdb96c0a977a15ec707d28404d97c3a6c (diff) |
OSSL_PARAM_get_*_ptr: Drop errors from ptr/string mismatch
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17997)
(cherry picked from commit 327a720d5dd011b853acbdd0223933f6ecd22928)
Diffstat (limited to 'crypto/params.c')
-rw-r--r-- | crypto/params.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/crypto/params.c b/crypto/params.c index cf86eea3c7..1028db1b38 100644 --- a/crypto/params.c +++ b/crypto/params.c @@ -1487,14 +1487,25 @@ static int get_string_ptr_internal(const OSSL_PARAM *p, const void **val, int OSSL_PARAM_get_utf8_string_ptr(const OSSL_PARAM *p, const char **val) { - return OSSL_PARAM_get_utf8_ptr(p, val) - || get_string_ptr_internal(p, (const void **)val, NULL, - OSSL_PARAM_UTF8_STRING); + int rv; + + ERR_set_mark(); + rv = OSSL_PARAM_get_utf8_ptr(p, val); + ERR_pop_to_mark(); + + return rv || get_string_ptr_internal(p, (const void **)val, NULL, + OSSL_PARAM_UTF8_STRING); } int OSSL_PARAM_get_octet_string_ptr(const OSSL_PARAM *p, const void **val, size_t *used_len) { - return OSSL_PARAM_get_octet_ptr(p, val, used_len) - || get_string_ptr_internal(p, val, used_len, OSSL_PARAM_OCTET_STRING); + int rv; + + ERR_set_mark(); + rv = OSSL_PARAM_get_octet_ptr(p, val, used_len); + ERR_pop_to_mark(); + + return rv || get_string_ptr_internal(p, val, used_len, + OSSL_PARAM_OCTET_STRING); } |