From 476e97f280f5fa146f3ab676dd6f07de481ad9e8 Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Wed, 17 Jun 2015 10:17:00 +1200 Subject: [PATCH] MDL-50614 mod_scorm: Improve validation on currentorg --- mod/scorm/player.php | 8 ++++++++ mod/scorm/prereqs.php | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/mod/scorm/player.php b/mod/scorm/player.php index 92c87d2ed4a..060fdd4f16e 100644 --- a/mod/scorm/player.php +++ b/mod/scorm/player.php @@ -51,6 +51,14 @@ if (!empty($id)) { } else { print_error('missingparameter'); } + +// PARAM_RAW is used for $currentorg, validate it against records stored in the table. +if (!empty($currentorg)) { + if (!$DB->record_exists('scorm_scoes', array('scorm' => $scorm->id, 'identifier' => $currentorg))) { + $currentorg = ''; + } +} + // If new attempt is being triggered set normal mode and increment attempt number. $attempt = scorm_get_last_attempt($scorm->id, $USER->id); diff --git a/mod/scorm/prereqs.php b/mod/scorm/prereqs.php index 25711beae32..00a7662daea 100644 --- a/mod/scorm/prereqs.php +++ b/mod/scorm/prereqs.php @@ -50,6 +50,13 @@ if (!empty($id)) { print_error('missingparameter'); } +// PARAM_RAW is used for $currentorg, validate it against records stored in the table. +if (!empty($currentorg)) { + if (!$DB->record_exists('scorm_scoes', array('scorm' => $scorm->id, 'identifier' => $currentorg))) { + $currentorg = ''; + } +} + $PAGE->set_url('/mod/scorm/prereqs.php', array('scoid' => $scoid, 'attempt' => $attempt, 'id' => $cm->id)); require_login($course, false, $cm);