Skip to content

Commit 971339f

Browse files
committed
fix(question,section): escaping bug on duplication
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
1 parent e9c27dd commit 971339f

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

inc/question.class.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,6 +1320,12 @@ public function duplicate() {
13201320
$row['uuid']);
13211321

13221322
$row['_skip_checks'] = true;
1323+
1324+
// escape text fields
1325+
foreach (['name', 'description'] as $key) {
1326+
$row[$key] = $DB->escape($row[$key]);
1327+
}
1328+
13231329
$newQuestion_id = $newQuestion->add($row);
13241330
if ($newQuestion_id === false) {
13251331
return false;

inc/section.class.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,12 @@ public function duplicate() {
169169
$row = $this->fields;
170170
unset($row['id'],
171171
$row['uuid']);
172+
173+
// escape text fields
174+
foreach (['name'] as $key) {
175+
$row[$key] = $DB->escape($row[$key]);
176+
}
177+
172178
$newSection_id = $newSection->add($row);
173179
if ($newSection_id === false) {
174180
return false;

0 commit comments

Comments
 (0)