summaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2020-04-20 15:04:35 +0100
committerMatt Caswell <matt@openssl.org>2020-04-22 10:41:58 +0100
commit555ed96812f7f6cfb6066327aee40244517e2e05 (patch)
tree511823118035f5808dee1764bbc994db651b2676 /crypto
parent9be92bec2eca839e26216cedc241f689c43125a5 (diff)
downloadopenssl-new-555ed96812f7f6cfb6066327aee40244517e2e05.tar.gz
Fix no-err
This fixes an assertion failure that can occur in the CMP code in the event of a no-err build. The "improve_location_name" function assumed that the fallback argument was always populated with something. However in a no-err build this is not the case. Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com> (Merged from https://github.com/openssl/openssl/pull/11584)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/cmp/cmp_util.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/cmp/cmp_util.c b/crypto/cmp/cmp_util.c
index 121b6a173a..741ed8082d 100644
--- a/crypto/cmp/cmp_util.c
+++ b/crypto/cmp/cmp_util.c
@@ -114,8 +114,9 @@ const char *ossl_cmp_log_parse_metadata(const char *buf,
*/
static const char *improve_location_name(const char *func, const char *fallback)
{
- if (!ossl_assert(fallback != NULL))
- return NULL;
+ if (fallback == NULL)
+ return func == NULL ? UNKNOWN_FUNC : func;
+
return func == NULL || *func == '\0' || strcmp(func, UNKNOWN_FUNC) == 0
? fallback : func;
}