talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit be4091e52342eb578944733861a77ca78e66eb6f
parent 610b8c5dccea59ffc5f2b609c8c9081372f5af24
Author: Charles Lehner <celehner1@gmail.com>
Date:   Thu,  3 Dec 2015 18:50:15 -0500

Fix enum scan on powerpc

Casting the enum pointers to char pointers (or unsigned char pointers) was
leading to config->auth getting the wrong value scanned on little-endian 32-bit
PowerPC systems. Using separate variables and implicit type coercion fixes this.

Diffstat:
Msrc/plugins/managesieve/sieve_prefs.c | 12+++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/plugins/managesieve/sieve_prefs.c b/src/plugins/managesieve/sieve_prefs.c @@ -463,6 +463,7 @@ struct SieveAccountConfig *sieve_prefs_account_get_config( const gchar *confstr; gchar enc_userid[256], enc_passwd[256]; gchar enable, use_host, use_port; + guchar tls_type, auth, auth_type; gsize len; #if defined(G_OS_WIN32) || defined(__OpenBSD__) /* Windows sscanf() does not understand the %ms format yet, so we @@ -501,12 +502,17 @@ struct SieveAccountConfig *sieve_prefs_account_get_config( &config->host, #endif &use_port, &config->port, - (char *)&config->tls_type, - (char *)&config->auth, - (char *)&config->auth_type, + &tls_type, + &auth, + &auth_type, enc_userid, enc_passwd); + /* Scan enums separately, for endian purposes */ + config->tls_type = tls_type; + config->auth = auth; + config->auth_type = auth_type; + #if defined(G_OS_WIN32) || defined(__OpenBSD__) config->host = g_strndup(tmphost, 255); #endif