Fix enum scan on powerpc
authorCharles Lehner <celehner1@gmail.com>
Thu, 3 Dec 2015 23:50:15 +0000 (18:50 -0500)
committerCharles Lehner <charles@claws-mail.org>
Thu, 3 Dec 2015 23:58:29 +0000 (18:58 -0500)
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.

src/plugins/managesieve/sieve_prefs.c

index 9976da7d4e70bd7c4ace17993ca269c19022327c..0d537627fd3d1a71073ddf7b0bfb6cc9565c44dc 100644 (file)
@@ -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