]> granicus.if.org Git - mutt/commitdiff
prevent user from setting $charset to an empty string since other code requires it...
authorMichael Elkins <me@sigpipe.org>
Sun, 4 Apr 2010 03:34:04 +0000 (20:34 -0700)
committerMichael Elkins <me@sigpipe.org>
Sun, 4 Apr 2010 03:34:04 +0000 (20:34 -0700)
closes #3326

init.c

diff --git a/init.c b/init.c
index 97dc7fcf6213952f39e2f237e45d87f0b8e8af0e..399153c264e1690b399b80c766926b95e5da8549 100644 (file)
--- a/init.c
+++ b/init.c
@@ -1892,8 +1892,10 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
         }
         else if (DTYPE (MuttVars[idx].type) == DT_STR)
         {
-         if (strstr (MuttVars[idx].option, "charset") &&
-             check_charset (&MuttVars[idx], tmp->data) < 0)
+         if ((strstr (MuttVars[idx].option, "charset") &&
+              check_charset (&MuttVars[idx], tmp->data) < 0) |
+             /* $charset can't be empty, others can */
+             (strcmp(MuttVars[idx].option, "charset") == 0 && ! *tmp->data))
          {
            snprintf (err->data, err->dsize, _("Invalid value for option %s: \"%s\""),
                      MuttVars[idx].option, tmp->data);