turnitin / moodle-plagiarism_turnitin

Turnitin Plagiarism plugin for Moodle
http://www.turnitin.com
45 stars 65 forks source link

Code does not trap for an "empty" $modname #716

Open mhughes2k opened 1 week ago

mhughes2k commented 1 week ago

Line 2905 in turnitin/lib.php has a condition where the $modname can end up being "".

This line https://github.com/turnitin/moodle-plagiarism_turnitin/blob/8cf0d4f8dbad46a36079c5f4b77ea294a1dcf8cc/lib.php#L1652 does not check that $modname is not empty and on that assumption tries to instantiate a class called "turnitin_".

This should have a check that the class is a valid one.

This seems to be caused by https://github.com/turnitin/moodle-plagiarism_turnitin/blob/8cf0d4f8dbad46a36079c5f4b77ea294a1dcf8cc/lib.php#L2908 which checks for a mod name being set and if not found sets $modname to '', which will result in never finding a valid class in the line above.

So either you need to validate the instantiation of the class to a valid class name or there is something incorrect that L2908 is ending up with an empty modname.