From: Neil Horman Date: Tue, 30 Dec 2025 16:39:41 +0000 (-0500) Subject: Remove dead code in b64_write X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6ab93b7835e090b6dfa3a32d9558c1c25e51409;p=thirdparty%2Fopenssl.git Remove dead code in b64_write recent updates triggered this coverity issues: https://scan5.scan.coverity.com/#/project-view/60762/10222?selectedIssue=1677834 Because ret is initalized to zero, and checked prior to any further update, the first return statement in this change is unreachable Further the return ret == 0 ? i : ret statement makes teh setting of buf_len and buf_off unreachable. Remove all of this unreachable code Reviewed-by: Saša Nedvědický Reviewed-by: Nikola Pajkovsky (Merged from https://github.com/openssl/openssl/pull/29525) --- diff --git a/crypto/evp/bio_b64.c b/crypto/evp/bio_b64.c index ff5c4e41ed2..0079268e46d 100644 --- a/crypto/evp/bio_b64.c +++ b/crypto/evp/bio_b64.c @@ -407,17 +407,13 @@ static int b64_write(BIO *b, const char *in, int inl) int n_bytes_enc = 0; if (!EVP_EncodeUpdate(ctx->base64, encoded, &n_bytes_enc, (unsigned char *)in, inl)) { - if (ret == 0) - return -1; - return ret; + return -1; } ret += inl; i = BIO_write(next, encoded, n_bytes_enc); if (i <= 0) { BIO_copy_next_retry(b); return ret == 0 ? i : ret; - ctx->buf_len = 0; - ctx->buf_off = 0; } return ret; }