]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-15184: fix sql injection vulnerability
authorgbateson <gbateson>
Tue, 1 Jul 2008 10:49:22 +0000 (10:49 +0000)
committergbateson <gbateson>
Tue, 1 Jul 2008 10:49:22 +0000 (10:49 +0000)
mod/hotpot/report.php

index b8c027dfc2e556e294cabe347181e86a8e0f3917..c982fbb08d3934bdb63c3411492e1156c23fb141 100644 (file)
@@ -380,10 +380,14 @@ function hotpot_delete_selected_attempts(&$hotpot, $del) {
             $select = "hotpot=:hotpotid AND status=".HOTPOT_STATUS_ABANDONED;
             break;
         case 'selection':
-            $ids = (array)data_submitted();
-            unset($ids['del']);
-            unset($ids['id']);
-            if (!empty($ids)) {
+            $ids = array();
+            $data = (array)data_submitted();
+            foreach ($data as $name => $value) {
+                if (preg_match('/^box\d+$/', $name)) {
+                    $ids[] = intval($value);
+                }
+            }
+            if (count($ids)) {
                 list($ids, $idparams) = $DB->get_in_or_equal($ids, SQL_PARAMS_NAMED, 'crid0');
                 $params = array_merge($params, $idparams); 
                 $select = "hotpot=:hotpotid AND clickreportid $ids";