]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
apps/lib/apps.c: fix the wrong check in check_cert_attributes
authorPeiwei Hu <jlu.hpw@foxmail.com>
Sun, 27 Oct 2024 09:02:32 +0000 (17:02 +0800)
committerTomas Mraz <tomas@openssl.org>
Fri, 22 Nov 2024 11:09:38 +0000 (12:09 +0100)
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25811)

apps/lib/apps.c

index f4848cf92ab32f37b4f49f9c66d7fde82063c7d2..59cc6e18e0e47c09b25d8577880cea0adfa18de3 100644 (file)
@@ -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;