]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Don't clear errors on failure in CONF_modules_load_file_ex()
authorMatt Caswell <matt@openssl.org>
Wed, 4 Nov 2020 11:31:55 +0000 (11:31 +0000)
committerMatt Caswell <matt@openssl.org>
Fri, 6 Nov 2020 10:34:48 +0000 (10:34 +0000)
The call to CONF_modules_load() in CONF_modules_load_file_ex() can
return a negative number to indicate failure. This was incorrectly
being interpreted as "success" and therefore errors were being cleared
incorrectly.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/13311)

crypto/conf/conf_mod.c

index bd945766b895c551c39d88cf3e469573ad931ae2..e7fb890378986000d883bd7eeb1233d2d5060c47 100644 (file)
@@ -187,10 +187,11 @@ int CONF_modules_load_file_ex(OSSL_LIB_CTX *libctx, const char *filename,
     if ((flags & CONF_MFLAGS_IGNORE_RETURN_CODES) != 0 && !diagnostics)
         ret = 1;
 
-    if (ret)
+    if (ret > 0)
         ERR_pop_to_mark();
     else
         ERR_clear_last_mark();
+
     return ret;
 }