summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1994-03-17 23:29:16 +0000
committerKarl Heuer <kwzh@gnu.org>1994-03-17 23:29:16 +0000
commit5458f7f15818ccc49685ec9ac4e0195d77bb3fcf (patch)
treeb8e755971de3e2c0cb6aac3ebeff2882b50771ab /lisp
parentb9fdbd74d730703bc50c6a5f86fa0c4469fd375c (diff)
downloademacs-5458f7f15818ccc49685ec9ac4e0195d77bb3fcf.tar.gz
(rmail-convert-to-babyl-format): Check Content-Length field for consistency.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mail/rmail.el23
1 files changed, 20 insertions, 3 deletions
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 40ab9117264..057ae8f9804 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -928,9 +928,26 @@ argument causes us to read a file name and use that file as the inbox."
header-end t)
(let ((beg (point))
(eol (progn (end-of-line) (point))))
- (read (buffer-substring beg eol)))))))
- (and size (numberp size) (>= size 0)
- (goto-char (+ header-end size))))
+ (string-to-int (buffer-substring beg eol)))))))
+ (and size
+ (if (and (natnump size)
+ (<= (+ header-end size) (point-max))
+ ;; Make sure this would put us at a position
+ ;; that we could continue from.
+ (save-excursion
+ (goto-char (+ header-end size))
+ (skip-chars-forward "\n")
+ (or (eobp)
+ (and (looking-at "BABYL OPTIONS:")
+ (search-forward "\n\^_" nil t))
+ (and (looking-at "\^L")
+ (search-forward "\n\^_" nil t))
+ (let ((case-fold-search t))
+ (looking-at mmdf-delim1))
+ (looking-at "From "))))
+ (goto-char (+ header-end size))
+ (message "Ignoring invalid Content-Length field")
+ (sit-for 1 0 t))))
(if (re-search-forward
(concat "^[\^_]?\\("