Skip to content

Commit ba58b26

Browse files
committed
Internal: Sanitize option text and use Display::tag for generating option elements
See advisory GHSA-pxrh-3rcp-h7m6
1 parent 405b142 commit ba58b26

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

main/inc/lib/pear/HTML/QuickForm/select.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,11 @@ public function toHtml()
419419
if (!empty($strValues) && in_array($option['attr']['value'], $strValues, true)) {
420420
$option['attr']['selected'] = 'selected';
421421
}
422-
$strHtml .= $tabs . "<option" . $this->_getAttrString($option['attr']) . '>' .
423-
$option['text'] . "</option>";
422+
$strHtml .= $tabs.Display::tag(
423+
'option',
424+
Security::remove_XSS($option['text']),
425+
$option['attr']
426+
);
424427
}
425428
foreach ($this->_optgroups as $optgroup) {
426429
$strHtml .= $tabs . '<optgroup label="' . $optgroup['label'] . '">';
@@ -432,7 +435,11 @@ public function toHtml()
432435
$option['selected'] = 'selected';
433436
}
434437

435-
$strHtml .= $tabs . " <option" . $this->_getAttrString($option) . '>' .$text . "</option>";
438+
$strHtml .= $tabs.Display::tag(
439+
'option',
440+
Security::remove_XSS($text),
441+
$option
442+
);
436443
}
437444
$strHtml .= "</optgroup>";
438445
}

0 commit comments

Comments
 (0)