[security] XSS with malicious ENUM values

Signed-off-by: Marc Delisle <marc@infomarc.info>

Conflicts:
	libraries/Util.class.php
This commit is contained in:
Marc Delisle 2014-09-28 09:48:13 -04:00
parent 7dc42d93af
commit c1a3f85fbd
2 changed files with 14 additions and 6 deletions

View File

@ -316,6 +316,7 @@ EOT;
private function _getEnumSetInputBox($column_index, $criteriaValues,
$column_type, $column_id, $in_zoom_search_edit = false
) {
$column_type = htmlspecialchars($column_type);
$html_output = '';
$value = explode(
', ',
@ -985,7 +986,9 @@ EOT;
$html_output .= '<th>'
. htmlspecialchars($this->_columnNames[$column_index]) . '</th>';
$properties = $this->getColumnProperties($column_index, $column_index);
$html_output .= '<td>' . $properties['type'] . '</td>';
$html_output .= '<td>'
. htmlspecialchars($properties['type'])
. '</td>';
$html_output .= '<td>' . $properties['collation'] . '</td>';
$html_output .= '<td>' . $properties['func'] . '</td>';
// here, the data-type attribute is needed for a date/time picker
@ -996,11 +999,13 @@ EOT;
$html_output .= '<tr><td>';
$html_output .= '<input type="hidden"'
. ' name="criteriaColumnNames[' . $column_index . ']"'
. ' value="' . htmlspecialchars($this->_columnNames[$column_index])
. ' value="'
. htmlspecialchars($this->_columnNames[$column_index])
. '" />';
$html_output .= '<input type="hidden"'
. ' name="criteriaColumnTypes[' . $column_index . ']"'
. ' value="' . $this->_columnTypes[$column_index] . '" />';
. ' value="'
. htmlspecialchars($this->_columnTypes[$column_index]) . '" />';
$html_output .= '<input type="hidden"'
. ' name="criteriaColumnCollations[' . $column_index . ']"'
. ' value="' . $this->_columnCollations[$column_index] . '" />';

View File

@ -3029,9 +3029,12 @@ class PMA_Util
// for the case ENUM('&#8211;','&ldquo;')
$displayed_type = htmlspecialchars($printtype);
if (strlen($printtype) > $GLOBALS['cfg']['LimitChars']) {
$displayed_type = '<abbr title="' . $printtype . '">';
$displayed_type .= $GLOBALS['PMA_String']->substr(
$printtype, 0, $GLOBALS['cfg']['LimitChars']
$displayed_type = '<abbr title="'
. htmlspecialchars($printtype) . '">';
$displayed_type .= htmlspecialchars(
$GLOBALS['PMA_String']->substr(
$printtype, 0, $GLOBALS['cfg']['LimitChars']
)
);
$displayed_type .= '</abbr>';
}