]> git.eshelyaron.com Git - emacs.git/commitdiff
Make address parsing more robust
authorLars Ingebrigtsen <larsi@gnus.org>
Wed, 25 Jan 2017 20:21:40 +0000 (21:21 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Wed, 25 Jan 2017 20:21:40 +0000 (21:21 +0100)
* lisp/mail/ietf-drums.el (ietf-drums-parse-address): Don't
bug out on addresses like
(ietf-drums-parse-address "\"Foo \"bar\" <larsi@gnus.org>")
(bug#18572).

lisp/mail/ietf-drums.el

index a3e53cfe7930f23cf8d31be2c23911d9a40e0549..fd793a28309412f1d2a5928d7f29064fdfd48a75 100644 (file)
@@ -192,6 +192,17 @@ the Content-Transfer-Encoding header of a mail."
       (ietf-drums-init string)
       (while (not (eobp))
        (setq c (char-after))
+        ;; If we have an uneven number of quote characters,
+        ;; `forward-sexp' will fail.  In these cases, just delete the
+        ;; final of these quote characters.
+        (when (and (eq c ?\")
+                   (not
+                    (save-excursion
+                      (ignore-errors
+                        (forward-sexp 1)
+                        t))))
+          (delete-char 1)
+          (setq c (char-after)))
        (cond
         ((or (eq c ? )
              (eq c ?\t))