oopsie, small fixes.
authorPierre Habouzit <madcoder@debian.org>
Tue, 14 Nov 2006 22:47:22 +0000 (23:47 +0100)
committerPierre Habouzit <madcoder@debian.org>
Tue, 14 Nov 2006 22:47:22 +0000 (23:47 +0100)
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
charset.c

index 544b357..a1541f0 100644 (file)
--- a/charset.c
+++ b/charset.c
@@ -66,10 +66,9 @@ void mutt_canonical_charset(char *dest, ssize_t dlen, const char *name)
     // canonize name: only keep a-z0-9 and dots, put into lowercase
     for (i = 0; i < ssizeof(scratch); i++) {
         if (isalnum(*name) || *name == '.') {
-            scratch[i++] = tolower((unsigned char)*name);
-        }
-
-        if (!*name || *name == ':') {
+            scratch[i] = tolower((unsigned char)*name);
+        } else
+        if (!*name || *name == ':' || i + 1 == ssizeof(scratch)) {
             scratch[i] = '\0';
             break;
         }