]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix Rmail summary display when From: header is malformed
authorEli Zaretskii <eliz@gnu.org>
Sat, 26 Dec 2020 10:35:34 +0000 (12:35 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sat, 26 Dec 2020 10:35:34 +0000 (12:35 +0200)
* lisp/mail/rmailsum.el (rmail-header-summary): Remove newlines
from the "From:" value, to avoid producing corrupted summary
display.

lisp/mail/rmailsum.el

index cc55451902ae62c24113f8c992c14ef1c0a40f57..2eda3222a47718e6d17ebd4e5da13c9e78f18dec 100644 (file)
@@ -786,6 +786,11 @@ the message being processed."
                 ;; To: =?UTF-8?Q?=C5=A0t=C4=9Bp=C3=A1n_?= =?UTF-8?Q?N=C4=9Bmec?=
                 ;; <stepnem@gmail.com>
                 (setq from (rfc2047-decode-string from))
+                 ;; We cannot tolerate any leftover newlines in From,
+                 ;; as that disrupts the rmail-summary display.
+                 ;; Newlines can be left in From if it was malformed,
+                 ;; e.g. had unbalanced quotes.
+                 (setq from (replace-regexp-in-string "\n+" " " from))
                 (setq len (length from))
                 (setq mch (string-match "[@%]" from))
                 (format "%25s"