summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2022-08-02 20:51:17 -0700
committerKevin McCarthy <kevin@8t8.us>2022-08-05 12:33:29 -0700
commit40228035ce0f397e682c985201df51dead3be3dc (patch)
treedb8aa223cb934a4ee4fd78b039823ba12f4c511b
parent4d2b33baa8ccf9efc721af525edba19cf5e9664e (diff)
Fix mutt_read_rfc822_line() to use is_email_wsp().
ISSPACE() uses isspace() which is locale-dependent. On some platforms, unexpected 8-bit chars, such as 0xa0 or 0x85 return true. When using $edit_headers, this can result in Subject: lines being truncated if a multi-byte character ending in one of these values is at the end of a line. There are probably other bugs that could be triggered by this, such as in IMAP parsing. However, I need more time to investigate before making large-scale changes that could introduce new bugs.
-rw-r--r--parse.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/parse.c b/parse.c
index 7ed1668f..897281a4 100644
--- a/parse.c
+++ b/parse.c
@@ -58,7 +58,7 @@ char *mutt_read_rfc822_line (FILE *f, char *line, size_t *linelen)
FOREVER
{
if (fgets (buf, *linelen - offset, f) == NULL || /* end of file or */
- (ISSPACE (*line) && !offset)) /* end of headers */
+ (is_email_wsp (*line) && !offset)) /* end of headers */
{
*line = 0;
return (line);
@@ -72,7 +72,7 @@ char *mutt_read_rfc822_line (FILE *f, char *line, size_t *linelen)
if (*buf == '\n')
{
/* we did get a full line. remove trailing space */
- while (ISSPACE (*buf))
+ while (is_email_wsp (*buf))
*buf-- = 0; /* we cannot come beyond line's beginning because
* it begins with a non-space */