]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
crypto/bio/bf_buff.c: drop extraneous ctx NULL check in buffer_ctrl()
authorEugene Syromiatnikov <esyr@openssl.org>
Mon, 26 Jan 2026 08:48:53 +0000 (09:48 +0100)
committerNeil Horman <nhorman@openssl.org>
Wed, 28 Jan 2026 12:56:46 +0000 (07:56 -0500)
b->ptr cannot be NULL, so, the check is not needed, drop it.
Reported by Coverity as a potential NULL dereference in ctx->ibuf_len
access.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1680636
Fixes: f17230ae6c9f "Fix of EOF and retry handling in BIO implementations"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed Jan 28 12:56:56 2026
(Merged from https://github.com/openssl/openssl/pull/29757)

crypto/bio/bf_buff.c

index ea6c72b0e094c4812efb330e8322af4752410576..00d0ec6e40fa01c9e123432f62b9af9fb15e4a75 100644 (file)
@@ -257,10 +257,10 @@ static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr)
         if (ctx->ibuf_len > 0)
             return 0;
         /*
-         * If there is no ctx or no next BIO, BIO_read() returns 0, which means
-         * EOF, BIO_eof() should return 1 in this case.
+         * If there is no next BIO, BIO_read() returns 0, which means EOF,
+         * BIO_eof() should return 1 in this case.
          */
-        if (ctx == NULL || b->next_bio == NULL)
+        if (b->next_bio == NULL)
             return 1;
         ret = BIO_ctrl(b->next_bio, cmd, num, ptr);
         break;