commit 73f5e52ee0c2086d588083836e9e74a31822cfe8 Author: Jacob Welsh AuthorDate: Sat Nov 26 21:39:01 2022 +0000 Commit: Jacob Welsh CommitDate: Sat Nov 26 21:39:01 2022 +0000 Type: cleanup Fix awkward or hazardous situations found by compiler warnings - doveadm/doveadm-oldstats.c(cmd_stats_top): unused variable (missed pruning in 9a28a60d61b6e6f6e992cefdc0ee056b721d0c8b) - imap-hibernate/imap-client.c(imap_client_input_idle_cmd): new_tag is supposed to be initialized by pointer output parameter but it's not obvious that it always is, so zero-initialize it to be on the safe side. - lib-http/test-http-client-errors.c: include signal.h by standard path (it's not under sys) - lib-storage/mail-storage-service.c(mail_storage_service_load_modules): control reaches end of non-void function (broken by 088279cc44ec62ae2befb0ce1c0ac9900f2f444a but return value was never used) - lib/compat.h: change the "unsigned long long" uoff_t case to the explicit uint64_t, for full agreement with its printf specifier PRIu64 and limit UINT64_MAX. Not addressed: lib-smtp/test-smtp-params.c:30:2: missing initializer for field 'used' of 'struct ' [-Wmissing-field-initializers] lib-smtp/test-smtp-params.c:34:2: missing initializer for field 'used' of 'struct ' [-Wmissing-field-initializers] - False positives from gcc 4.9. Various: passing argument 4 of 'module_load_static' from incompatible pointer type - Module init functions not conforming to API, previously loaded by dlsym without type checking. Shouldn't be a problem since they simply don't use the supplied parameters. Various unused variables and parameters, especially in perl-generated code. Various: comparison is always false due to limited range of data type [-Wtype-limits] - Seems to be an artifact of their COMPILE_ERROR_IF_TRUE implementation. diff --git a/NEWS b/NEWS index 583af5ce78..73814c00dc 100644 --- a/NEWS +++ b/NEWS @@ -34,6 +34,7 @@ v2.4.0 2022-11-26 Jacob Welsh < http://fixpoint.welshcomputing.com/ > - lib-charset: Drop iconv tests based on UTF-7 source encoding, which isn't implemented in musl and didn't turn up in a search of my own 12 year email collection. - lib: Fix file_cache_errors test on musl by not demanding specific error strings. + - imap-hibernate: Trap possible uninitialized use of pointer on stack (new_tag in imap_client_input_idle_cmd) by zeroing. - lib-imap: imap_bodystructure_parse_full(): Reset parts.data on failure to prevent caller confusion (ported from release-2.3 branch). Fixes: Panic: file message-part-data.c: line 579 (message_part_is_attachment): assertion failed: (data != NULL) diff --git a/config.h b/config.h index 944cafebdb..2063dea607 100644 --- a/config.h +++ b/config.h @@ -641,8 +641,8 @@ /* Define if off_t is long */ /* #undef UOFF_T_LONG */ -/* Define if off_t is long long */ -#define UOFF_T_LONG_LONG /* off_t is always 64-bit on musl */ +/* Define if off_t is int64_t */ +#define UOFF_T_INT64 /* off_t is always 64-bit on musl */ /* Maximum value of uoff_t */ #define UOFF_T_MAX UINT64_MAX /* off_t is always 64-bit on musl */ diff --git a/src/doveadm/doveadm-oldstats.c b/src/doveadm/doveadm-oldstats.c index dfbad83b12..e711a463ba 100644 --- a/src/doveadm/doveadm-oldstats.c +++ b/src/doveadm/doveadm-oldstats.c @@ -537,7 +537,6 @@ static void stats_reset(const char *path) static void cmd_stats_top(struct doveadm_cmd_context *cctx) { const char *path, *sort_type; - bool b; if (!doveadm_cmd_param_str(cctx, "socket-path", &path)) { path = t_strconcat(doveadm_settings->base_dir, diff --git a/src/imap-hibernate/imap-client.c b/src/imap-hibernate/imap-client.c index 50ae507586..9ec4a873a0 100644 --- a/src/imap-hibernate/imap-client.c +++ b/src/imap-hibernate/imap-client.c @@ -368,7 +368,7 @@ imap_client_input_parse(const unsigned char *data, size_t size, const char **tag static void imap_client_input_idle_cmd(struct imap_client *client) { char *old_tag; - const char *new_tag; + const char *new_tag = 0; const char *output; const unsigned char *data; size_t size; diff --git a/src/lib-http/test-http-client-errors.c b/src/lib-http/test-http-client-errors.c index e127041d64..7d2fd17f45 100644 --- a/src/lib-http/test-http-client-errors.c +++ b/src/lib-http/test-http-client-errors.c @@ -18,7 +18,7 @@ #include "http-client.h" #include -#include +#include #define CLIENT_PROGRESS_TIMEOUT 10 #define SERVER_KILL_TIMEOUT_SECS 20 diff --git a/src/lib-storage/mail-storage-service.c b/src/lib-storage/mail-storage-service.c index 822549dac3..8f9ae1deb8 100644 --- a/src/lib-storage/mail-storage-service.c +++ b/src/lib-storage/mail-storage-service.c @@ -1128,14 +1128,14 @@ mail_storage_service_first_init(struct mail_storage_service_ctx *ctx, auth_master_init(user_set->auth_socket_path, flags)); } -static int +static void mail_storage_service_load_modules(struct mail_storage_service_ctx *ctx, const struct mail_user_settings *user_set) { if (*user_set->mail_plugins == '\0') - return 0; + return; if ((ctx->flags & MAIL_STORAGE_SERVICE_FLAG_NO_PLUGINS) != 0) - return 0; + return; module_dir_load_mail(&mail_storage_service_modules, user_set->mail_plugins); } diff --git a/src/lib/compat.h b/src/lib/compat.h index ce3127ddb4..116783f825 100644 --- a/src/lib/compat.h +++ b/src/lib/compat.h @@ -62,8 +62,8 @@ typedef int bool; typedef unsigned int uoff_t; #elif defined (UOFF_T_LONG) typedef unsigned long uoff_t; -#elif defined (UOFF_T_LONG_LONG) -typedef unsigned long long uoff_t; +#elif defined (UOFF_T_INT64) +typedef uint64_t uoff_t; #else # error uoff_t size not set #endif