]> 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:41:57 +0000 (14:41 +0000)
committermkanat%bugzilla.org <>
Tue, 12 Aug 2008 14:41:57 +0000 (14:41 +0000)
Patch By Greg Hendricks <ghendricks@novell.com> r=LpSolit, a=mkanat

importxml.pl

index 6e6f4a6191e5c1e42f016cd65faae8fbfc0f01e9..f62fdab002ef735d9d86c854090ff90c2aebc4d5 100755 (executable)
@@ -379,8 +379,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;