aboutsummaryrefslogtreecommitdiff
path: root/mail/p5-MIME-Tools
diff options
context:
space:
mode:
authorMartin Blapp <mbr@FreeBSD.org>2004-09-02 22:27:53 +0000
committerMartin Blapp <mbr@FreeBSD.org>2004-09-02 22:27:53 +0000
commit25e1eade83ce190c65023070eb9383fa36b2483a (patch)
tree1ca1299c1ea2fae88628e8f8e29d75c7a9d2a252 /mail/p5-MIME-Tools
parent912535274955f6969ea3a3471259c7213d70f4b1 (diff)
downloadports-25e1eade83ce190c65023070eb9383fa36b2483a.tar.gz
ports-25e1eade83ce190c65023070eb9383fa36b2483a.zip
Remove whitspaces from exorcise_filename() and make evil_filename()
recognize path or special characters. Submitted by: Julian Field <mailscanner@ecs.soton.ac.uk> Martin Blapp <mbr@freebsd.org>
Notes
Notes: svn path=/head/; revision=117982
Diffstat (limited to 'mail/p5-MIME-Tools')
-rw-r--r--mail/p5-MIME-Tools/files/patch-Filer.pm-whitespace23
1 files changed, 23 insertions, 0 deletions
diff --git a/mail/p5-MIME-Tools/files/patch-Filer.pm-whitespace b/mail/p5-MIME-Tools/files/patch-Filer.pm-whitespace
new file mode 100644
index 000000000000..e011a0b7f4ed
--- /dev/null
+++ b/mail/p5-MIME-Tools/files/patch-Filer.pm-whitespace
@@ -0,0 +1,23 @@
+--- lib/MIME/Parser/Filer.pm Thu Nov 23 06:04:03 2000
++++ lib/MIME/Parser/Filer.pm Thu Aug 26 00:42:18 2004
+@@ -357,8 +357,9 @@
+ $self->debug("is this evil? '$name'");
+
+ return 1 if (!defined($name) or ($name eq '')); ### empty
++ return 1 if ($name =~ m{(^\s)|(\s+\Z)}); ### leading/trailing whitespace
+ return 1 if ($name =~ m{^\.+\Z}); ### dots
+- return 1 if ($name =~ tr{\\/:[]}{}); ### path characters
++ return 1 if ($name =~ /((?:[\[\]\\\/\<\>\|\?\*\:\"]|\p{IsCntrl}))/); ### path or special characters
+ return 1 if ($self->{MPF_MaxName} and
+ (length($name) > $self->{MPF_MaxName}));
+
+@@ -402,6 +403,9 @@
+ my ($root, $ext) = (($last =~ /^(.*)\.([^\.]+)\Z/)
+ ? ($1, $2)
+ : ($last, ''));
++ ### Delete leading and trailing whitespace
++ $root =~ s/^\s+//;
++ $ext =~ s/\s+$//;
+ $root = substr($root, 0, ($self->{MPF_TrimRoot} || 14));
+ $ext = substr($ext, 0, ($self->{MPF_TrimExt} || 3));
+ $ext =~ /^\w+$/ or $ext = "dat";