From: Eugene Syromiatnikov Date: Mon, 26 Jan 2026 08:48:53 +0000 (+0100) Subject: crypto/bio/bf_buff.c: drop extraneous ctx NULL check in buffer_ctrl() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7ad410d6c6a238260b2f7da547f4a38bd023b706;p=thirdparty%2Fopenssl.git crypto/bio/bf_buff.c: drop extraneous ctx NULL check in buffer_ctrl() 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 Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale Reviewed-by: Norbert Pocs Reviewed-by: Shane Lontis Reviewed-by: Neil Horman MergeDate: Wed Jan 28 12:56:56 2026 (Merged from https://github.com/openssl/openssl/pull/29757) --- diff --git a/crypto/bio/bf_buff.c b/crypto/bio/bf_buff.c index ea6c72b0e09..00d0ec6e40f 100644 --- a/crypto/bio/bf_buff.c +++ b/crypto/bio/bf_buff.c @@ -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;