Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-11053

Course object not escaped before insert

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 1.7.3, 1.8.3, 1.9
    • 1.8.2
    • Enrolments
    • None
    • MySQL
    • MOODLE_18_STABLE
    • MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE

    Description

      We have experienced problems when Course names and descriptions contain apostrophes. These problems were resolved when I wrapped $scourse in addslashes_object() before inserting it into the database, following the pattern I've seen in other Moodle code. I have not investigated any security implications.

      diff --git a/enrol/imsenterprise/enrol.php b/enrol/imsenterprise/enrol.php
      index c8271dd..5dce80d 100644
      — a/enrol/imsenterprise/enrol.php
      +++ b/enrol/imsenterprise/enrol.php
      @@ -554,7 +554,7 @@ function process_group_tag($tagcontents){
      }else

      { $course->sortorder = 1000; }
      • if($course->id = insert_record('course', $course)){
        + if($course->id = insert_record('course', addslashes_object($course))){

      // Setup the blocks
      $page = page_create_object(PAGE_COURSE_VIEW, $course->id);

      Attachments

        Activity

          People

            skodak Petr Skoda
            acspike Aaron C Spike
            Nobody Nobody
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              11/Oct/07