From 09fc90fb92376b385a1b1aaf2613b3b1c7191284 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Sun, 28 Nov 2021 16:45:29 +0000 Subject: [PATCH] tidying --- src/src/expand.c | 4 ++-- src/src/lookups/mysql.c | 2 +- src/src/pdkim/pdkim.c | 6 +++--- src/src/routers/rf_get_munge_headers.c | 12 +++++------ src/src/store.c | 12 +++++------ src/src/tls-openssl.c | 29 +++++++++++++------------- src/src/transports/smtp_socks.c | 4 ++-- 7 files changed, 34 insertions(+), 35 deletions(-) diff --git a/src/src/expand.c b/src/src/expand.c index bfae2a3c0..3bf87a67c 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -3490,9 +3490,9 @@ switch(cond_type = identify_operator(&s, &opname)) srs_recipient = string_sprintf("%.*s%.*S%.*s@%.*S", /* lowercased */ quoting, "\"", - ovec[9]-ovec[8], sub[0] + ovec[8], /* substring 4 */ + (int) (ovec[9]-ovec[8]), sub[0] + ovec[8], /* substr 4 */ quoting, "\"", - ovec[7]-ovec[6], sub[0] + ovec[6]); /* substring 3 */ + (int) (ovec[7]-ovec[6]), sub[0] + ovec[6]); /* substr 3 */ /* If a zero-length secret was given, we're done. Otherwise carry on and validate the given SRS local_part againt our secret. */ diff --git a/src/src/lookups/mysql.c b/src/src/lookups/mysql.c index 96f7c1fa1..4e6ca8a72 100644 --- a/src/src/lookups/mysql.c +++ b/src/src/lookups/mysql.c @@ -286,7 +286,7 @@ if (!(mysql_result = mysql_use_result(mysql_handle))) { DEBUG(D_lookup) debug_printf_indent("MYSQL: query was not one that returns data\n"); result = string_cat(result, - string_sprintf("%d", mysql_affected_rows(mysql_handle))); + string_sprintf("%lld", mysql_affected_rows(mysql_handle))); *do_cache = 0; goto MYSQL_EXIT; } diff --git a/src/src/pdkim/pdkim.c b/src/src/pdkim/pdkim.c index 05f656df4..3aa4360da 100644 --- a/src/src/pdkim/pdkim.c +++ b/src/src/pdkim/pdkim.c @@ -1265,7 +1265,7 @@ if (sig->identity) if (sig->created > 0) { - uschar minibuf[20]; + uschar minibuf[21]; snprintf(CS minibuf, sizeof(minibuf), "%lu", sig->created); hdr = pdkim_headcat(&col, hdr, US";", US"t=", minibuf); @@ -1273,7 +1273,7 @@ if (sig->created > 0) if (sig->expires > 0) { - uschar minibuf[20]; + uschar minibuf[21]; snprintf(CS minibuf, sizeof(minibuf), "%lu", sig->expires); hdr = pdkim_headcat(&col, hdr, US";", US"x=", minibuf); @@ -1281,7 +1281,7 @@ if (sig->expires > 0) if (sig->bodylength >= 0) { - uschar minibuf[20]; + uschar minibuf[21]; snprintf(CS minibuf, sizeof(minibuf), "%lu", sig->bodylength); hdr = pdkim_headcat(&col, hdr, US";", US"l=", minibuf); diff --git a/src/src/routers/rf_get_munge_headers.c b/src/src/routers/rf_get_munge_headers.c index 5c95d2d1c..5f0bbc993 100644 --- a/src/src/routers/rf_get_munge_headers.c +++ b/src/src/routers/rf_get_munge_headers.c @@ -38,17 +38,17 @@ if (rblock->extra_headers) { const uschar * list = rblock->extra_headers; int sep = '\n'; - uschar * s; + uschar * s, * t; int slen; while ((s = string_nextinlist(&list, &sep, NULL, 0))) - if (!(s = expand_string(s))) + if (!(s = expand_string(t = s))) { if (!f.expand_string_forcedfail) { addr->message = string_sprintf( "%s router failed to expand add_headers item \"%s\": %s", - rblock->name, s, expand_string_message); + rblock->name, t, expand_string_message); return DEFER; } } @@ -90,20 +90,20 @@ if (rblock->remove_headers) { const uschar * list = rblock->remove_headers; int sep = ':'; - uschar * s; + uschar * s, * t; gstring * g = NULL; if (*remove_headers) g = string_cat(NULL, *remove_headers); while ((s = string_nextinlist(&list, &sep, NULL, 0))) - if (!(s = expand_string(s))) + if (!(s = expand_string(t = s))) { if (!f.expand_string_forcedfail) { addr->message = string_sprintf( "%s router failed to expand remove_headers item \"%s\": %s", - rblock->name, s, expand_string_message); + rblock->name, t, expand_string_message); return DEFER; } } diff --git a/src/src/store.c b/src/src/store.c index c2e3f17bf..84f1ce351 100644 --- a/src/src/store.c +++ b/src/src/store.c @@ -876,14 +876,14 @@ a negative int, to the (unsigned, wider) size_t */ if (size >= INT_MAX/2) log_write(0, LOG_MAIN|LOG_PANIC_DIE, - "bad memory allocation requested (%lld bytes) at %s %d", - (unsigned long long)size, func, line); + "bad memory allocation requested (" SIZE_T_FMT " bytes) at %s %d", + size, func, line); size += sizeof(size_t); /* space to store the size, used under debug */ if (size < 16) size = 16; if (!(yield = malloc(size))) - log_write(0, LOG_MAIN|LOG_PANIC_DIE, "failed to malloc %d bytes of memory: " + log_write(0, LOG_MAIN|LOG_PANIC_DIE, "failed to malloc " SIZE_T_FMT " bytes of memory: " "called from line %d in %s", size, line, func); #ifndef COMPILE_UTILITY @@ -903,7 +903,7 @@ is not filled with zeros so as to catch problems. */ if (f.running_in_test_harness) memset(yield, 0xF0, size - sizeof(size_t)); -DEBUG(D_memory) debug_printf("--Malloc %6p %5lld bytes\t%-20s %4d\tpool %5d nonpool %5d\n", +DEBUG(D_memory) debug_printf("--Malloc %6p %5lu bytes\t%-20s %4d\tpool %5d nonpool %5d\n", yield, size, func, line, pool_malloc, nonpool_malloc); #endif /* COMPILE_UTILITY */ @@ -939,8 +939,8 @@ internal_store_free(void * block, const char * func, int linenumber) uschar * p = US block - sizeof(size_t); #ifndef COMPILE_UTILITY DEBUG(D_any) nonpool_malloc -= *(size_t *)p; -DEBUG(D_memory) debug_printf("----Free %6p %5lld bytes\t%-20s %4d\n", - block, (unsigned long long) *(size_t *)p, func, linenumber); +DEBUG(D_memory) debug_printf("----Free %6p %5ld bytes\t%-20s %4d\n", + block, *(size_t *)p, func, linenumber); #endif free(p); } diff --git a/src/src/tls-openssl.c b/src/src/tls-openssl.c index 356d39eff..391dc2695 100644 --- a/src/src/tls-openssl.c +++ b/src/src/tls-openssl.c @@ -608,34 +608,33 @@ if (!(dh = PEM_read_bio_DHparams(bio, NULL, NULL, NULL))) } /* note: our default limit of 2236 is not a multiple of 8; the limit comes from - * an NSS limit, and the GnuTLS APIs handle bit-sizes fine, so we went with - * 2236. But older OpenSSL can only report in bytes (octets), not bits. - * If someone wants to dance at the edge, then they can raise the limit or use - * current libraries. */ +an NSS limit, and the GnuTLS APIs handle bit-sizes fine, so we went with 2236. +But older OpenSSL can only report in bytes (octets), not bits. If someone wants +to dance at the edge, then they can raise the limit or use current libraries. */ + #ifdef EXIM_HAVE_OPENSSL_DH_BITS /* Added in commit 26c79d5641d; `git describe --contains` says OpenSSL_1_1_0-pre1~1022 - * This predates OpenSSL_1_1_0 (before a, b, ...) so is in all 1.1.0 */ +This predates OpenSSL_1_1_0 (before a, b, ...) so is in all 1.1.0 */ dh_bitsize = DH_bits(dh); #else dh_bitsize = 8 * DH_size(dh); #endif -/* Even if it is larger, we silently return success rather than cause things - * to fail out, so that a too-large DH will not knock out all TLS; it's a - * debatable choice. */ -if (dh_bitsize > tls_dh_max_bits) - { - DEBUG(D_tls) - debug_printf("dhparams file %d bits, is > tls_dh_max_bits limit of %d\n", - dh_bitsize, tls_dh_max_bits); - } -else +/* Even if it is larger, we silently return success rather than cause things to +fail out, so that a too-large DH will not knock out all TLS; it's a debatable +choice. */ + +if (dh_bitsize <= tls_dh_max_bits) { SSL_CTX_set_tmp_dh(sctx, dh); DEBUG(D_tls) debug_printf("Diffie-Hellman initialized from %s with %d-bit prime\n", dhexpanded ? dhexpanded : US"default", dh_bitsize); } +else + DEBUG(D_tls) + debug_printf("dhparams file %d bits, is > tls_dh_max_bits limit of %d\n", + dh_bitsize, tls_dh_max_bits); DH_free(dh); BIO_free(bio); diff --git a/src/src/transports/smtp_socks.c b/src/src/transports/smtp_socks.c index 0234c9b5d..5aff62c15 100644 --- a/src/src/transports/smtp_socks.c +++ b/src/src/transports/smtp_socks.c @@ -322,7 +322,7 @@ if ( buf[0] != 5 ) goto proxy_err; - { + { union sockaddr_46 sin; (void) ip_addr(&sin, host_af, host->address, port); @@ -345,7 +345,7 @@ if ( buf[0] != 5 &sin.v4.sin_port, sizeof(sin.v4.sin_port)); size = 4+sizeof(sin.v4.sin_addr.s_addr)+sizeof(sin.v4.sin_port); } - } + } state = US"connect"; HDEBUG(D_transport|D_acl|D_v) -- 2.30.2