]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 437169: [SECURITY] Local files on the server can be attached to a bug (making...
authormkanat%bugzilla.org <>
Tue, 12 Aug 2008 14:42:22 +0000 (14:42 +0000)
committermkanat%bugzilla.org <>
Tue, 12 Aug 2008 14:42:22 +0000 (14:42 +0000)
Patch By Greg Hendricks <ghendricks@novell.com> r=LpSolit, a=mkanat

importxml.pl

index 53478b0e3df0e827f874179c8c6b3dd900facb06..4821ca5b9b3a9b8edbc06f052bbb5831bfa55804 100755 (executable)
@@ -416,8 +416,13 @@ sub process_attachment() {
         elsif ($encoding =~ /filename/) {
             # read the attachment file
             Error("attach_path is required", undef) unless ($attach_path);
-            my $attach_filename = $attach_path . "/" . $attach->field('data');
-            open(ATTACH_FH, $attach_filename) or
+            
+            my $filename = $attach->field('data');
+            # Remove any leading path data from the filename
+            $filename =~ s/(.*\/|.*\\)//gs;
+            
+            my $attach_filename = $attach_path . "/" . $filename;
+            open(ATTACH_FH, "<", $attach_filename) or
                 Error("cannot open $attach_filename", undef);
             $attachment{'data'} = do { local $/; <ATTACH_FH> };
             close ATTACH_FH;