From 1a93be1eab54acc720a3e645c11dc84002285879 Mon Sep 17 00:00:00 2001 From: Peiwei Hu Date: Sun, 27 Oct 2024 17:02:32 +0800 Subject: [PATCH] apps/lib/apps.c: fix the wrong check in check_cert_attributes Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/25811) --- apps/lib/apps.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/lib/apps.c b/apps/lib/apps.c index f4848cf92a..59cc6e18e0 100644 --- a/apps/lib/apps.c +++ b/apps/lib/apps.c @@ -2216,7 +2216,7 @@ int check_cert_attributes(BIO *bio, X509 *x, const char *checkhost, if (print) BIO_printf(bio, "Hostname %s does%s match certificate\n", checkhost, valid_host == 1 ? "" : " NOT"); - ret = ret && valid_host; + ret = ret && valid_host > 0; } if (checkemail != NULL) { @@ -2224,7 +2224,7 @@ int check_cert_attributes(BIO *bio, X509 *x, const char *checkhost, if (print) BIO_printf(bio, "Email %s does%s match certificate\n", checkemail, valid_mail ? "" : " NOT"); - ret = ret && valid_mail; + ret = ret && valid_mail > 0; } if (checkip != NULL) { @@ -2232,7 +2232,7 @@ int check_cert_attributes(BIO *bio, X509 *x, const char *checkhost, if (print) BIO_printf(bio, "IP %s does%s match certificate\n", checkip, valid_ip ? "" : " NOT"); - ret = ret && valid_ip; + ret = ret && valid_ip > 0; } return ret;