(nnimap-parse-line): Protect against invalid data.
authorLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Mon, 27 Sep 2010 18:22:36 +0000 (20:22 +0200)
committerLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Mon, 27 Sep 2010 18:22:36 +0000 (20:22 +0200)
lisp/ChangeLog
lisp/nnimap.el

index 4b07815..cbbaff3 100644 (file)
@@ -4,6 +4,7 @@
        since some servers don't like it.
        (nnimap-open-connection): Forget credentials if the server says the
        password was wrong.
+       (nnimap-parse-line): Protect against invalid data.
 
        * gnus-sum.el (gnus-summary-move-article): Add comment.
        (gnus-summary-insert-new-articles): Copy the old-high watermark so that
index 830aa7d..7a065cc 100644 (file)
@@ -1212,13 +1212,18 @@ some servers.")
           (cond
            ((eql char ?\[)
             (split-string (buffer-substring
-                           (1+ (point)) (1- (search-forward "]")))))
+                           (1+ (point))
+                           (1- (search-forward "]" (line-end-position) 'move)))))
            ((eql char ?\()
             (split-string (buffer-substring
-                           (1+ (point)) (1- (search-forward ")")))))
+                           (1+ (point))
+                           (1- (search-forward ")" (line-end-position) 'move)))))
            ((eql char ?\")
             (forward-char 1)
-            (buffer-substring (point) (1- (search-forward "\""))))
+            (buffer-substring
+             (point)
+             (1- (or (search-forward "\"" (line-end-position) 'move)
+                     (point)))))
            (t
             (buffer-substring (point) (if (search-forward " " nil t)
                                           (1- (point))