Commit f88b214ad6 for openssl.org
commit f88b214ad6168dfecf32210f13e4b9e726407a28
Author: Bob Beck <beck@openssl.org>
Date: Wed Jun 17 19:34:20 2026 -0600
Convert BIO_snprintf() in BIO_debug_callback_ex() to snprintf() and guard the offset.
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Andrew Dinh <andrewd@openssl.org>
MergeDate: Wed Aug 26 16:20:19 2026
(Merged from https://github.com/openssl/openssl/pull/31640)
diff --git a/crypto/bio/bio_cb.c b/crypto/bio/bio_cb.c
index f0e387eb1b..d8927c327f 100644
--- a/crypto/bio/bio_cb.c
+++ b/crypto/bio/bio_cb.c
@@ -30,10 +30,10 @@ long BIO_debug_callback_ex(BIO *bio, int cmd, const char *argp, size_t len,
if (processed != NULL)
l = *processed;
- left = BIO_snprintf(buf, sizeof(buf), "BIO[%p]: ", (void *)bio);
+ left = snprintf(buf, sizeof(buf), "BIO[%p]: ", (void *)bio);
/* Ignore errors and continue printing the other information. */
- if (left < 0)
+ if (left < 0 || (size_t)left >= sizeof(buf))
left = 0;
p = buf + left;
left = sizeof(buf) - left;