]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
OSSL_PARAM_get_*_ptr: Drop errors from ptr/string mismatch
authorTomas Mraz <tomas@openssl.org>
Mon, 28 Mar 2022 17:13:22 +0000 (19:13 +0200)
committerPauli <ppzgs1@gmail.com>
Sun, 3 Apr 2022 02:58:05 +0000 (12:58 +1000)
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17997)

crypto/params.c

index a1a04a6b4d2f53cc86a2e1a5bdb9685c0d8a1969..321b919ccc955ec5328c39f46411b149f16ba3e2 100644 (file)
@@ -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);
 }