[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sup-devel] [PATCH] Fixed inline gpg crash when the end marker is missing



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
---
 lib/sup/message.rb |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/lib/sup/message.rb b/lib/sup/message.rb
index 9f488af..69669bd 100644
--- a/lib/sup/message.rb
+++ b/lib/sup/message.rb
@@ -559,7 +559,8 @@ private
     end
 
     gpg = lines.between(GPG_START, GPG_END)
-    if !gpg.empty?
+    # between does not check if GPG_END actually exists
+    if !gpg.empty? && !lines.index(GPG_END).nil?
       msg = RMail::Message.new
       msg.body = gpg.join("\n")
 
-- 
1.7.2.2

_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel