Fix more dead code in b64_write

https://scan5.scan.coverity.com/#/project-view/60762/10222?selectedIssue=1677831

reports more dead code in b64_write

ret is incremented by inl in b64_write prior to being tested for zero.
Since inl is previously tested for being <= 0, and returns if it is, ret
must be at least 1 during the test, making the trinary test dead code.

Just return -1 here.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29525)
This commit is contained in:
Neil Horman
2025-12-30 13:52:38 -05:00
parent 3e8a68008c
commit 3b69cc994c

View File

@@ -411,10 +411,8 @@ static int b64_write(BIO *b, const char *in, int inl)
}
ret += inl;
i = BIO_write(next, encoded, n_bytes_enc);
if (i <= 0) {
if (i <= 0)
BIO_copy_next_retry(b);
return ret == 0 ? i : ret;
}
return ret;
}