emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master de28ae7: Make nnimap parse pathological spam header


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master de28ae7: Make nnimap parse pathological spam headers better
Date: Fri, 13 Apr 2018 13:29:11 -0400 (EDT)

branch: master
commit de28ae70effd64755e7543fd2cef90f8de5d8019
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    Make nnimap parse pathological spam headers better
    
    * lisp/gnus/nnimap.el (nnimap-transform-headers): Unfold certain
    pathological IMAP headers more correctly (bug#25502).  Perhaps
    this function should be re-implemented.
---
 lisp/gnus/nnimap.el | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el
index 0d85a29..dc51b5f 100644
--- a/lisp/gnus/nnimap.el
+++ b/lisp/gnus/nnimap.el
@@ -220,15 +220,16 @@ textual parts.")
            (cl-return)))
        (goto-char (match-end 0))
        ;; Unfold quoted {number} strings.
-       (while (re-search-forward
-               "[^]][ (]{\\([0-9]+\\)}\r?\n"
-               (save-excursion
-                 ;; Start of the header section.
-                 (or (re-search-forward "] {[0-9]+}\r?\n" nil t)
-                     ;; Start of the next FETCH.
-                     (re-search-forward "\\* [0-9]+ FETCH" nil t)
-                     (point-max)))
-               t)
+       (while (or (looking-at "[ (]{\\([0-9]+\\)}\r?\n")
+                  (re-search-forward
+                   "[^]][ (]{\\([0-9]+\\)}\r?\n"
+                   (save-excursion
+                     ;; Start of the header section.
+                     (or (re-search-forward "] {[0-9]+}\r?\n" nil t)
+                         ;; Start of the next FETCH.
+                         (re-search-forward "\\* [0-9]+ FETCH" nil t)
+                         (point-max)))
+                   t))
          (setq size (string-to-number (match-string 1)))
          (delete-region (+ (match-beginning 0) 2) (point))
          (setq string (buffer-substring (point) (+ (point) size)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]