]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-9123:
authorthepurpleblob <thepurpleblob>
Wed, 11 Apr 2007 11:00:26 +0000 (11:00 +0000)
committerthepurpleblob <thepurpleblob>
Wed, 11 Apr 2007 11:00:26 +0000 (11:00 +0000)
No check was made of the validity of the category id read from the form.
So it could theoretically have been spoofed.

question/export.php

index f81d2952473f7ca2d5c5aa66ab58fda2a5c608b7..fe8401032a9358110ac0cd9c6651bf93b5056fa7 100644 (file)
     // ensure the files area exists for this course
     make_upload_directory( "$course->id" );
 
+    // check category is valid
+    if (!empty($categoryid)) {
+        $validcats = question_category_options( $course->id, true, false );
+        if (!array_key_exists( $categoryid, $validcats)) {
+            print_error( "Category id ($categoryid) is not permitted." );
+        }
+    }
+
     /// Header
     if (isset($SESSION->modform->instance) and $quiz = get_record('quiz', 'id', $SESSION->modform->instance)) {
         $strupdatemodule = has_capability('moodle/course:manageactivities', $context)