Commit 6c8d2ed33b for openssl.org
commit 6c8d2ed33b181242f0388a5f875c454a0001568d
Author: Bob Beck <beck@openssl.org>
Date: Wed Jun 17 19:46:30 2026 -0600
Convert remaining BIO_snprintf() callers in cmp_client.c to snprintf().
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Andrew Dinh <andrewd@openssl.org>
MergeDate: Wed Aug 26 16:20:26 2026
(Merged from https://github.com/openssl/openssl/pull/31640)
diff --git a/crypto/cmp/cmp_client.c b/crypto/cmp/cmp_client.c
index c039941204..de28e4f33f 100644
--- a/crypto/cmp/cmp_client.c
+++ b/crypto/cmp/cmp_client.c
@@ -9,6 +9,8 @@
* https://www.openssl.org/source/license.html
*/
+#include <stdio.h>
+
#include "cmp_local.h"
#include <inttypes.h>
@@ -231,7 +233,7 @@ static int send_receive_check(OSSL_CMP_CTX *ctx, const OSSL_CMP_MSG *req,
!= NULL)
ERR_add_error_data(1, buf);
if (emc->errorCode != NULL
- && BIO_snprintf(buf, sizeof(buf), "; errorCode: %08lX",
+ && snprintf(buf, sizeof(buf), "; errorCode: %08lX",
ASN1_INTEGER_get(emc->errorCode))
> 0)
ERR_add_error_data(1, buf);
@@ -318,18 +320,21 @@ static int poll_for_response(OSSL_CMP_CTX *ctx, int sleep, int rid,
}
if (pollRep->reason == NULL
- || (len = BIO_snprintf(str, OSSL_CMP_PKISI_BUFLEN,
+ || (len = snprintf(str, OSSL_CMP_PKISI_BUFLEN,
" with reason = '"))
- < 0) {
+ < 0
+ || (size_t)len >= OSSL_CMP_PKISI_BUFLEN) {
*str = '\0';
} else {
char *text = ossl_sk_ASN1_UTF8STRING2text(pollRep->reason, ", ",
sizeof(str) - len - 2);
+ int n;
if (text == NULL
- || BIO_snprintf(str + len, sizeof(str) - len,
- "%s'", text)
- < 0)
+ || (n = snprintf(str + len, sizeof(str) - len,
+ "%s'", text))
+ < 0
+ || (size_t)n >= sizeof(str) - len)
*str = '\0';
OPENSSL_free(text);
}
diff --git a/crypto/cmp/cmp_status.c b/crypto/cmp/cmp_status.c
index 9b646db682..8483dd290e 100644
--- a/crypto/cmp/cmp_status.c
+++ b/crypto/cmp/cmp_status.c
@@ -11,6 +11,8 @@
/* CMP functions for PKIStatusInfo handling and PKIMessage decomposition */
+#include <stdio.h>
+
#include "cmp_local.h"
/* CMP functions related to PKIStatus */