Commit 81b946f5 81b946f50fa7b85436ed9ba6fd81ec7d432eebc5 by Wojciech Polak

Fixed

1 parent 997808e9
...@@ -1342,14 +1342,18 @@ util_run_cached_commands (list_t *list) ...@@ -1342,14 +1342,18 @@ util_run_cached_commands (list_t *list)
1342 void 1342 void
1343 util_rfc2047_decode (char **value) 1343 util_rfc2047_decode (char **value)
1344 { 1344 {
1345 char locale[32];
1345 char *charset = NULL; 1346 char *charset = NULL;
1346 char *tmp; 1347 char *tmp;
1347 int rc; 1348 int rc;
1348 1349
1349 if (!*value || util_getenv (&charset, "charset", Mail_env_string, 0)) 1350 if (!*value || util_getenv (&charset, "charset", Mail_env_string, 0))
1350 return; 1351 return;
1352
1351 if (strcasecmp (charset, "auto") == 0) 1353 if (strcasecmp (charset, "auto") == 0)
1352 { 1354 {
1355 memset (locale, 0, sizeof (locale));
1356
1353 /* Try to deduce the charset from LC_ALL or LANG variables */ 1357 /* Try to deduce the charset from LC_ALL or LANG variables */
1354 1358
1355 tmp = getenv ("LC_ALL"); 1359 tmp = getenv ("LC_ALL");
...@@ -1362,7 +1366,9 @@ util_rfc2047_decode (char **value) ...@@ -1362,7 +1366,9 @@ util_rfc2047_decode (char **value)
1362 char *lang; 1366 char *lang;
1363 char *terr; 1367 char *terr;
1364 1368
1365 lang = strtok_r (tmp, "_", &sp); 1369 strncpy (locale, tmp, sizeof (locale) - 1);
1370
1371 lang = strtok_r (locale, "_", &sp);
1366 terr = strtok_r (NULL, ".", &sp); 1372 terr = strtok_r (NULL, ".", &sp);
1367 charset = strtok_r (NULL, "@", &sp); 1373 charset = strtok_r (NULL, "@", &sp);
1368 1374
......