From e6da58fb3c198f24d274779de013f28b1ca1b9d2 Mon Sep 17 00:00:00 2001 From: gbateson Date: Tue, 1 Jul 2008 10:47:40 +0000 Subject: [PATCH] MDL-15184: fix sql injection vulnerability --- mod/hotpot/report.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/mod/hotpot/report.php b/mod/hotpot/report.php index 296b02cba8a..c5e6eec6d92 100644 --- a/mod/hotpot/report.php +++ b/mod/hotpot/report.php @@ -365,10 +365,14 @@ function hotpot_delete_selected_attempts(&$hotpot, $del) { $select = "hotpot='$hotpot->id' 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)) { $select = "hotpot='$hotpot->id' AND clickreportid IN (".implode(',', $ids).")"; } break;