]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix incomplete BIO_dup_state() error check
authorndossche <niels.dossche@ugent.be>
Thu, 2 Feb 2023 13:02:34 +0000 (14:02 +0100)
committerTodd Short <todd.short@me.com>
Wed, 8 Feb 2023 15:58:47 +0000 (10:58 -0500)
BIO_dup_state() returns an error code <= 0 according to my analysis tool
and the documentation. Currently only == 0 is checked. Fix it by
changing the check condition.

CLA: trivial

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/20194)

crypto/bio/bio_lib.c

index 4708b984fa5d27ca1d27875cf689becfb326c00b..2848d55934d42a63115c0db6e2c00f303a86fe17 100644 (file)
@@ -886,7 +886,7 @@ BIO *BIO_dup_chain(BIO *in)
         /* This will let SSL_s_sock() work with stdin/stdout */
         new_bio->num = bio->num;
 
-        if (!BIO_dup_state(bio, (char *)new_bio)) {
+        if (BIO_dup_state(bio, (char *)new_bio) <= 0) {
             BIO_free(new_bio);
             goto err;
         }