Commit b85de00861 for openssl.org
commit b85de00861cb0ce19de324caa6c9e17cc249ca32
Author: Bob Beck <beck@openssl.org>
Date: Wed Jun 17 19:52:43 2026 -0600
Convert internal BIO_vsnprintf() callers to vsnprintf().
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Andrew Dinh <andrewd@openssl.org>
MergeDate: Wed Aug 26 16:20:27 2026
(Merged from https://github.com/openssl/openssl/pull/31640)
diff --git a/crypto/cmp/cmp_ctx.c b/crypto/cmp/cmp_ctx.c
index 5358897107..7e1c43a89c 100644
--- a/crypto/cmp/cmp_ctx.c
+++ b/crypto/cmp/cmp_ctx.c
@@ -9,6 +9,8 @@
* https://www.openssl.org/source/license.html
*/
+#include <stdio.h>
+
#include "cmp_local.h"
#include <openssl/ocsp.h> /* for OCSP_REVOKED_STATUS_* */
@@ -381,7 +383,7 @@ int ossl_cmp_print_log(OSSL_CMP_severity level, const OSSL_CMP_CTX *ctx,
"%s:%s:%d:" OSSL_CMP_LOG_PREFIX "%s: ",
func, file, line, level_str);
if (printed > 0 && (size_t)printed < sizeof(hugebuf)) {
- if (BIO_vsnprintf(hugebuf + printed,
+ if (vsnprintf(hugebuf + printed,
sizeof(hugebuf) - printed, format, args)
> 0)
res = BIO_puts(trc_out, hugebuf) > 0;
@@ -391,7 +393,7 @@ int ossl_cmp_print_log(OSSL_CMP_severity level, const OSSL_CMP_CTX *ctx,
}
#else /* compensate for disabled trace API */
{
- if (BIO_vsnprintf(hugebuf, sizeof(hugebuf), format, args) > 0)
+ if (vsnprintf(hugebuf, sizeof(hugebuf), format, args) > 0)
res = ctx->log_cb(func, file, line, level, hugebuf);
}
#endif
diff --git a/crypto/err/err_blocks.c b/crypto/err/err_blocks.c
index 90451ea880..05de163280 100644
--- a/crypto/err/err_blocks.c
+++ b/crypto/err/err_blocks.c
@@ -7,6 +7,7 @@
* https://www.openssl.org/source/license.html
*/
+#include <stdio.h>
#include <string.h>
#include <openssl/err.h>
#include "err_local.h"
@@ -85,9 +86,9 @@ void ERR_vset_error(int lib, int reason, const char *fmt, va_list args)
}
if (buf != NULL) {
- printed_len = BIO_vsnprintf(buf, buf_size, fmt, args);
+ printed_len = vsnprintf(buf, buf_size, fmt, args);
}
- if (printed_len < 0)
+ if (printed_len < 0 || (size_t)printed_len >= buf_size)
printed_len = 0;
if (buf != NULL)
buf[printed_len] = '\0';