]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 754090: Bugzilla::FlagType::match() crashes when the group parameter is not a...
authorFrédéric Buclin <LpSolit@gmail.com>
Mon, 21 May 2012 18:07:33 +0000 (20:07 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Mon, 21 May 2012 18:07:33 +0000 (20:07 +0200)
a=LpSolit

Bugzilla/FlagType.pm
editflagtypes.cgi

index b30065a1cf70bc56ebbfa18a3051edb986b4d608..15d9827444c4e77b7916271c331486d888457a51 100644 (file)
@@ -681,7 +681,10 @@ sub sqlify_criteria {
     }
     if ($criteria->{product_id}) {
         my $product_id = $criteria->{product_id};
-        
+        detaint_natural($product_id)
+          || ThrowCodeError('bad_arg', { argument => 'product_id',
+                                         function => 'Bugzilla::FlagType::sqlify_criteria' });
+
         # Add inclusions to the query, which simply involves joining the table
         # by flag type ID and target product/component.
         push(@$tables, "INNER JOIN flaginclusions AS i ON flagtypes.id = i.type_id");
@@ -698,6 +701,10 @@ sub sqlify_criteria {
         my $addl_join_clause = "";
         if ($criteria->{component_id}) {
             my $component_id = $criteria->{component_id};
+            detaint_natural($component_id)
+              || ThrowCodeError('bad_arg', { argument => 'component_id',
+                                             function => 'Bugzilla::FlagType::sqlify_criteria' });
+
             push(@criteria, "(i.component_id = $component_id OR i.component_id IS NULL)");
             $join_clause .= "AND (e.component_id = $component_id OR e.component_id IS NULL) ";
         }
@@ -711,7 +718,10 @@ sub sqlify_criteria {
     }
     if ($criteria->{group}) {
         my $gid = $criteria->{group};
-        detaint_natural($gid);
+        detaint_natural($gid)
+          || ThrowCodeError('bad_arg', { argument => 'group',
+                                         function => 'Bugzilla::FlagType::sqlify_criteria' });
+
         push(@criteria, "(flagtypes.grant_group_id = $gid " .
                         " OR flagtypes.request_group_id = $gid)");
     }
index d78942c07e80c47e62bca81c205447795871f1ce..d75bebba290fef257165612406fc3ed7110b1c9e 100755 (executable)
@@ -156,6 +156,9 @@ if ($action eq 'list') {
     my $component_id = $component ? $component->id : 0;
     my $show_flag_counts = $cgi->param('show_flag_counts') ? 1 : 0;
     my $group_id = $cgi->param('group');
+    if ($group_id) {
+        detaint_natural($group_id) || ThrowUserError('invalid_group_ID');
+    }
 
     my $bug_flagtypes;
     my $attach_flagtypes;