summaryrefslogtreecommitdiffstats
path: root/post_bug.cgi
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2014-10-06 16:25:06 +0200
committerDavid Lawrence <dkl@mozilla.com>2014-10-06 16:25:06 +0200
commitce590bf022ef6c2fc0c0c902d773ec7a53e7e4ad (patch)
tree3708d76568e9b7152fbb8dbe8c1b7b5690b8394c /post_bug.cgi
parentb07267acd0301aef84aa74fc4aea39481cea6ad5 (diff)
downloadbugzilla-ce590bf022ef6c2fc0c0c902d773ec7a53e7e4ad.tar.gz
bugzilla-ce590bf022ef6c2fc0c0c902d773ec7a53e7e4ad.tar.xz
Bug 1075578: [SECURITY] Improper filtering of CGI arguments
r=dkl,a=sgreen
Diffstat (limited to 'post_bug.cgi')
-rwxr-xr-xpost_bug.cgi9
1 files changed, 6 insertions, 3 deletions
diff --git a/post_bug.cgi b/post_bug.cgi
index c0878b0da..6e1ecec81 100755
--- a/post_bug.cgi
+++ b/post_bug.cgi
@@ -168,7 +168,10 @@ if (defined $cgi->param('version')) {
# after the bug is filed.
# Add an attachment if requested.
-if (defined($cgi->upload('data')) || $cgi->param('attach_text')) {
+my $data_fh = $cgi->upload('data');
+my $attach_text = $cgi->param('attach_text');
+
+if ($data_fh || $attach_text) {
$cgi->param('isprivate', $cgi->param('comment_is_private'));
# Must be called before create() as it may alter $cgi->param('ispatch').
@@ -183,9 +186,9 @@ if (defined($cgi->upload('data')) || $cgi->param('attach_text')) {
$attachment = Bugzilla::Attachment->create(
{bug => $bug,
creation_ts => $timestamp,
- data => scalar $cgi->param('attach_text') || $cgi->upload('data'),
+ data => $attach_text || $data_fh,
description => scalar $cgi->param('description'),
- filename => $cgi->param('attach_text') ? "file_$id.txt" : scalar $cgi->upload('data'),
+ filename => $attach_text ? "file_$id.txt" : $data_fh,
ispatch => scalar $cgi->param('ispatch'),
isprivate => scalar $cgi->param('isprivate'),
mimetype => $content_type,