[Privoxy-commits] [privoxy] 09/16: create_hexadecimal_hash_of_host(): Use snprintf() instead of sprint()
User Git
git at git.privoxy.org
Mon Dec 22 11:30:15 CET 2025
This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository privoxy.
commit 8d65ffa68a6d262b13893b54dff285d4b2626898
Author: Fabian Keil <fk at fabiankeil.de>
AuthorDate: Sun Dec 21 13:21:20 2025 +0100
create_hexadecimal_hash_of_host(): Use snprintf() instead of sprint()
Silences a warning on OpenBSD.
---
ssl_common.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/ssl_common.c b/ssl_common.c
index f9103248..e3badef6 100644
--- a/ssl_common.c
+++ b/ssl_common.c
@@ -754,16 +754,18 @@ extern int enforce_sane_certificate_state(const char *certificate, const char *k
*********************************************************************/
int create_hexadecimal_hash_of_host(struct client_state *csp)
{
- int i;
+ unsigned int i;
int ret;
for (i = 0; i < HASH_OF_HOST_BUF_SIZE; i++)
{
- ret = sprintf((char *)csp->http->hash_of_host_hex + 2 * i, "%02x",
+ unsigned int j = 2 * i;
+ ret = snprintf((char *)csp->http->hash_of_host_hex + j,
+ sizeof(csp->http->hash_of_host_hex) - j, "%02x",
csp->http->hash_of_host[i]);
if (ret < 0)
{
- log_error(LOG_LEVEL_ERROR, "sprintf() return value: %d", ret);
+ log_error(LOG_LEVEL_ERROR, "snprintf() return value: %d", ret);
return -1;
}
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Privoxy-commits
mailing list