Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: sup-devel <sup-devel@rubyforge.org>
Subject: [sup-devel] Fix crash when opening attachment with slashes in filename
Date: Thu, 29 Jul 2010 23:09:04 -0400	[thread overview]
Message-ID: <1280459186-sup-8579@alvh.no-ip.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 292 bytes --]

Hi,

This patch fixes a crash caused by trying to create a temp file with
forward slashes.  The fix is simple -- replace the slashes with a
different char.

I reported this as issue 105 on masanjin.net previously, but that's
apparently dead now.

--
Álvaro Herrera <alvherre@alvh.no-ip.org>

[-- Attachment #2: msgchunks.diff --]
[-- Type: application/octet-stream, Size: 748 bytes --]

From eb25896e484f59963ed7c5f543d00fad031d03d2 Mon Sep 17 00:00:00 2001
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: Thu, 29 Jul 2010 22:59:20 -0400
Subject: [PATCH] Fix crash on handling attachment filename with slashes

---
 lib/sup/message-chunks.rb |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/sup/message-chunks.rb b/lib/sup/message-chunks.rb
index c275f41..be4416f 100644
--- a/lib/sup/message-chunks.rb
+++ b/lib/sup/message-chunks.rb
@@ -149,7 +149,7 @@ EOS
     end
 
     def write_to_disk
-      file = Tempfile.new(@filename || "sup-attachment")
+      file = Tempfile.new(@filename.gsub("/", "_") || "sup-attachment")
       file.print @raw_content
       file.close
       file.path
-- 
1.7.1


[-- Attachment #3: Type: text/plain, Size: 143 bytes --]

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

                 reply	other threads:[~2010-07-30  4:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1280459186-sup-8579@alvh.no-ip.org \
    --to=alvherre@alvh.no-ip.org \
    --cc=sup-devel@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox