From: Tomas Mraz Date: Mon, 28 Mar 2022 17:13:22 +0000 (+0200) Subject: OSSL_PARAM_get_*_ptr: Drop errors from ptr/string mismatch X-Git-Tag: openssl-3.2.0-alpha1~2794 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=327a720d5dd011b853acbdd0223933f6ecd22928;p=thirdparty%2Fopenssl.git OSSL_PARAM_get_*_ptr: Drop errors from ptr/string mismatch Reviewed-by: Dmitry Belyavskiy Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/17997) --- diff --git a/crypto/params.c b/crypto/params.c index a1a04a6b4d2..321b919ccc9 100644 --- a/crypto/params.c +++ b/crypto/params.c @@ -1506,14 +1506,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); }