]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix incomplete error check on BIO_set_accept_name()
authorndossche <niels.dossche@ugent.be>
Fri, 3 Feb 2023 12:43:03 +0000 (13:43 +0100)
committerTodd Short <todd.short@me.com>
Wed, 8 Feb 2023 14:35:19 +0000 (09:35 -0500)
BIO_set_accept_name() can return error values -1 and 0 according to
my analysis tool and the documentation. Documentation says a value of 1
indicates success. Currently, only an error value != 0 is checked which
erroneously interprets a -1 error return value as success.
Fix it by changing the check condition.

CLA: trivial

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/20206)

crypto/bio/bss_acpt.c

index 806186ae41e02a166568f9563a402c4e3758ad4c..9514727cdf67136dedd3023f16e7e7e5fc238322 100644 (file)
@@ -568,7 +568,7 @@ BIO *BIO_new_accept(const char *str)
     ret = BIO_new(BIO_s_accept());
     if (ret == NULL)
         return NULL;
-    if (BIO_set_accept_name(ret, str))
+    if (BIO_set_accept_name(ret, str) > 0)
         return ret;
     BIO_free(ret);
     return NULL;