summaryrefslogtreecommitdiff
path: root/lisp/gnus/mm-uu.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/gnus/mm-uu.el')
-rw-r--r--lisp/gnus/mm-uu.el12
1 files changed, 10 insertions, 2 deletions
diff --git a/lisp/gnus/mm-uu.el b/lisp/gnus/mm-uu.el
index b1ed0b7af4e..311dce0d1b2 100644
--- a/lisp/gnus/mm-uu.el
+++ b/lisp/gnus/mm-uu.el
@@ -373,8 +373,16 @@ Return that buffer."
mm-security-handle 'gnus-details
(format "Clear verification not supported by `%s'.\n" mml2015-use))))
(goto-char (point-min))
- (if (re-search-forward "\n[\t ]*\n" nil t)
- (delete-region (point-min) (point)))
+ (forward-line)
+ ;; We need to be careful not to strip beyond the armor headers.
+ ;; Previously, an attacker could replace the text inside our
+ ;; markup with trailing garbage by injecting whitespace into the
+ ;; message.
+ (while (looking-at "Hash:") ; The only header allowed in cleartext
+ (forward-line)) ; signatures according to RFC2440.
+ (when (looking-at "[\t ]*$")
+ (forward-line))
+ (delete-region (point-min) (point))
(if (re-search-forward mm-uu-pgp-beginning-signature nil t)
(delete-region (match-beginning 0) (point-max)))
(goto-char (point-min))