From c0e2e7a1d5aae4cdbb00a88c66205b175033b67d Mon Sep 17 00:00:00 2001 From: Michael Elkins Date: Sat, 3 Apr 2010 20:34:04 -0700 Subject: [PATCH] prevent user from setting $charset to an empty string since other code requires it to be set to a valid string closes #3326 --- init.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/init.c b/init.c index 97dc7fcf6..399153c26 100644 --- 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); -- 2.40.0