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

Course object not escaped before insert

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.2
    • Fix Version/s: 1.7.3, 1.8.3, 1.9
    • Component/s: Enrolments
    • Labels:
      None
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_18_STABLE
    • Fixed Branches:
      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

            • Assignee:
              skodak Petr Skoda
              Reporter:
              acspike Aaron C Spike
              Tester:
              Nobody
              Participants:
              Component watchers:
              Amaia Anabitarte, David Mudrák (@mudrd8mz), Sara Arjona (@sarjona)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                11/Oct/07