From 966f1c6c277386552a49a6825912e74cd860e68a Mon Sep 17 00:00:00 2001 From: Kevin Easton Date: Thu, 3 Nov 2016 00:53:33 +1100 Subject: [PATCH] Apply correct casts to check_ext_mail and check_ext_mail_status As always, the funcion pointers should be cast to the correct type before calling them, rather than calling them with the wrong type and trying to cast the result. Fixes a warning compiling mail.c on 64 bit architectures, and this might well have caused a crash when using the qmail plugin on those architectures too. --- Changelog | 4 ++++ source/mail.c | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Changelog b/Changelog index e1fede1..a92fd1f 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,9 @@ [Changes 1.2.2] +* Cast check_ext_mail and check_ext_mail_status function pointers to the + correct type before using them. This might have caused a problem with + the qmail plugin on 64 bit architectures. (caf) + * Fix bug in DCC privileged port detection logic. (caf) * Don't show DCC "Handshake failed" message twice, improve the message itself diff --git a/source/mail.c b/source/mail.c index 0634961..b4b2455 100644 --- a/source/mail.c +++ b/source/mail.c @@ -87,8 +87,8 @@ int count_maildir_mail(void) #ifdef WANT_DLL -#define check_ext_mail global_table[CHECK_EXT_MAIL] -#define check_ext_mail_status global_table[CHECK_EXT_MAIL_STATUS] +#define check_ext_mail ((char *(*)(void))global_table[CHECK_EXT_MAIL]) +#define check_ext_mail_status ((int (*)(void))global_table[CHECK_EXT_MAIL_STATUS]) #endif /* @@ -111,7 +111,7 @@ static time_t old_stat = 0; struct stat stat_buf; #endif #ifdef WANT_DLL - if (check_ext_mail) + if (check_ext_mail_status) return (*check_ext_mail_status)(); #endif if (!get_int_var(MAIL_VAR)) @@ -182,7 +182,7 @@ static char ret_str[12]; static int i = 0; #ifdef WANT_DLL if (check_ext_mail) - return (char *)(*check_ext_mail)(); + return (*check_ext_mail)(); #endif switch (get_int_var(MAIL_VAR)) {