On Mar 15, 2012 12:08 AM, "Austin Clements" <amdragon@mit.edu> wrote:
>
> On Sun,  4 Mar 2012 10:25:38 +0200, Jani Nikula <jani@nikula.org> wrote:
> > The reply MML quoting added in commit ae438cc unintentionally MML
> > quotes also the signature/encryption MML tags added via
> > message-setup-hook, causing the reply not to be signed/encrypted.
> >
> > MML quote just the original message in the temp buffer before
> > inserting it to the message buffer, to not interfere with message mode
> > hooks or message construction in general.
> >
> > See [1] and [2] for bug reports.
> >
> > Thanks to Tim Bielawa <tbielawa@redhat.com> for testing.
> >
> > [1] id:"87hay78x6l.fsf@wyzanski.jamesvasile.com"
> > [2] id:"1330812262-28272-1-git-send-email-tbielawa@redhat.com".
> >
> > Signed-off-by: Jani Nikula <jani@nikula.org>
> > ---
> >  emacs/notmuch-mua.el |   10 ++++------
> >  1 files changed, 4 insertions(+), 6 deletions(-)
> >
> > diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
> > index 4be7c13..13244eb 100644
> > --- a/emacs/notmuch-mua.el
> > +++ b/emacs/notmuch-mua.el
> > @@ -95,6 +95,9 @@ list."
> >             (goto-char (point-min))
> >             (setq headers (mail-header-extract)))))
> >        (forward-line 1)
> > +      ;; Original message may contain (malicious) MML tags. We must
> > +      ;; properly quote them in the reply.
> > +      (mml-quote-region (point) (point-max))
>
> Under what circumstances can the (re-search-forward "^$" nil t) above
> this code fail?  If it does fail, is it possible for the (forward-line 1)
> to move past an adversary-controlled line of text and fail to quote that
> line?

It doesn't matter. The quoting is done between point and point-max, and the message body to cite is extracted right after quoting using: (setq body (buffer-substring (point) (point-max)))).

BR,
Jani.