commit 53da8841347baf86692ee5da920eb2512356dd04
parent 8f592630eedb9c47eb79ef4237c3693724fa3bd1
Author: Michael Hamann <michael@content-space.de>
Date: Sat, 22 Jun 2013 12:29:22 -0700
Merge #85: Check if GPG end marker exists
Picked up by @manizzle.
"lines.between() does not check if the end marker actually exists, but
later it is assumed the marker exists. This change introduces a check
for the end marker and doesn't decrypt messages in which the end marker
is missing. This is a fix for http://rubyforge.org/pipermail/sup-talk/2010-August/004209.html"
Source:
http://permalink.gmane.org/gmane.mail.sup.devel/641
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/sup/message.rb b/lib/sup/message.rb
@@ -540,7 +540,9 @@ private
def inline_gpg_to_chunks body, encoding_to, encoding_from
lines = body.split("\n")
gpg = lines.between(GPG_SIGNED_START, GPG_SIGNED_END)
- if !gpg.empty?
+ # between does not check if GPG_END actually exists
+ # Reference: http://permalink.gmane.org/gmane.mail.sup.devel/641
+ if !gpg.empty? && !lines.index(GPG_END).nil?
msg = RMail::Message.new
msg.body = gpg.join("\n")