From 07203b0bb8eae22005ebeea71734c7ea70b3b4a1 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 29 Nov 2022 16:45:39 +0100 Subject: [PATCH] openssl/mbedtls: use %d for outputing port with failf (int) Coverity CID 1517100 Also, remove some int typecasts in vtls.c for the port number Closes #10001 --- lib/vtls/mbedtls.c | 2 +- lib/vtls/openssl.c | 2 +- lib/vtls/vtls.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/vtls/mbedtls.c b/lib/vtls/mbedtls.c index e131ac06c2..0b81662b93 100644 --- a/lib/vtls/mbedtls.c +++ b/lib/vtls/mbedtls.c @@ -541,7 +541,7 @@ mbed_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data) } #endif - infof(data, "mbedTLS: Connecting to %s:%ld", hostname, connssl->port); + infof(data, "mbedTLS: Connecting to %s:%d", hostname, connssl->port); mbedtls_ssl_config_init(&backend->config); ret = mbedtls_ssl_config_defaults(&backend->config, diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c index 8d93d41e27..0f04fcdb05 100644 --- a/lib/vtls/openssl.c +++ b/lib/vtls/openssl.c @@ -3989,7 +3989,7 @@ static CURLcode ossl_connect_step2(struct Curl_cfilter *cf, if(sockerr && detail == SSL_ERROR_SYSCALL) Curl_strerror(sockerr, extramsg, sizeof(extramsg)); - failf(data, OSSL_PACKAGE " SSL_connect: %s in connection to %s:%ld ", + failf(data, OSSL_PACKAGE " SSL_connect: %s in connection to %s:%d ", extramsg[0] ? extramsg : SSL_ERROR_to_str(detail), connssl->hostname, connssl->port); return result; diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c index 303efc39d2..e84c99346f 100644 --- a/lib/vtls/vtls.c +++ b/lib/vtls/vtls.c @@ -1451,7 +1451,7 @@ static void reinit_hostname(struct Curl_cfilter *cf) /* TODO: there is not definition for a proxy setup on a secondary conn */ connssl->hostname = cf->conn->http_proxy.host.name; connssl->dispname = cf->conn->http_proxy.host.dispname; - connssl->port = (int)cf->conn->http_proxy.port; + connssl->port = cf->conn->http_proxy.port; } else #endif @@ -1462,12 +1462,12 @@ static void reinit_hostname(struct Curl_cfilter *cf) if(cf->sockindex == SECONDARYSOCKET && 0) { connssl->hostname = cf->conn->secondaryhostname; connssl->dispname = connssl->hostname; - connssl->port = (int)cf->conn->secondary_port; + connssl->port = cf->conn->secondary_port; } else { connssl->hostname = cf->conn->host.name; connssl->dispname = cf->conn->host.dispname; - connssl->port = (int)cf->conn->remote_port; + connssl->port = cf->conn->remote_port; } } DEBUGASSERT(connssl->hostname); -- 2.47.3