Skip to content

Commit 64623fe

Browse files
author
Marc Delisle
committed
[security] Code execution vulnerability
1 parent b108d54 commit 64623fe

2 files changed

Lines changed: 34 additions & 18 deletions

File tree

ChangeLog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ danbarry
109109
contains accents
110110
+ [lang] Spanish update, thanks to Daniel Hinostroza
111111

112+
2.11.9.1 (2008-09-15)
113+
- [security] Code execution vulnerability, thanks to Norman Hippert
114+
112115
2.11.9.0 (2008-08-28)
113116
- bug #2031221 [auth] Links to version number on login screen
114117
- bug #2032707 [core] PMA does not start if ini_set() is disabled

libraries/database_interface.lib.php

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,32 @@ function PMA_DBI_get_tables($database, $link = null)
184184
null, 0, $link, PMA_DBI_QUERY_STORE);
185185
}
186186

187+
/**
188+
* usort comparison callback
189+
*
190+
* @param string $a first argument to sort
191+
* @param string $b second argument to sort
192+
*
193+
* @return integer a value representing whether $a should be before $b in the
194+
* sorted array or not
195+
*
196+
* @global string the column the array shall be sorted by
197+
* @global string the sorting order ('ASC' or 'DESC')
198+
*
199+
* @access private
200+
*/
201+
function PMA_usort_comparison_callback($a, $b)
202+
{
203+
if ($GLOBALS['cfg']['NaturalOrder']) {
204+
$sorter = 'strnatcasecmp';
205+
} else {
206+
$sorter = 'strcasecmp';
207+
}
208+
// produces f.e.:
209+
// return -1 * strnatcasecmp($a["SCHEMA_TABLES"], $b["SCHEMA_TABLES"])
210+
return ($GLOBALS['callback_sort_order'] == 'ASC' ? 1 : -1) * $sorter($a[$GLOBALS['callback_sort_by']], $b[$GLOBALS['callback_sort_by']]);
211+
} // end of the 'PMA_usort_comparison_callback()' function
212+
187213
/**
188214
* returns array of all tables in given db or dbs
189215
* this function expects unquoted names:
@@ -405,7 +431,7 @@ function PMA_DBI_get_tables_full($database, $table = false,
405431
* @param string $databases database
406432
* @param boolean $force_stats retrieve stats also for MySQL < 5
407433
* @param resource $link mysql link
408-
* @param string $sort_by collumn to order by
434+
* @param string $sort_by column to order by
409435
* @param string $sort_order ASC or DESC
410436
* @param integer $limit_offset starting offset for LIMIT
411437
* @param bool|int $limit_count row count for LIMIT or true for $GLOBALS['cfg']['MaxDbList']
@@ -550,23 +576,10 @@ function PMA_DBI_get_databases_full($database = null, $force_stats = false,
550576
* (caused by older MySQL < 5 or $GLOBALS['cfg']['NaturalOrder'])
551577
*/
552578
if ($apply_limit_and_order_manual) {
553-
554-
/**
555-
* first apply ordering
556-
*/
557-
if ($GLOBALS['cfg']['NaturalOrder']) {
558-
$sorter = 'strnatcasecmp';
559-
} else {
560-
$sorter = 'strcasecmp';
561-
}
562-
563-
// produces f.e.:
564-
// return -1 * strnatcasecmp($a["SCHEMA_TABLES"], $b["SCHEMA_TABLES"])
565-
$sort_function = '
566-
return ' . ($sort_order == 'ASC' ? 1 : -1) . ' * ' . $sorter . '($a["' . $sort_by . '"], $b["' . $sort_by . '"]);
567-
';
568-
569-
usort($databases, create_function('$a, $b', $sort_function));
579+
$GLOBALS['callback_sort_order'] = $sort_order;
580+
$GLOBALS['callback_sort_by'] = $sort_by;
581+
usort($databases, 'PMA_usort_comparison_callback');
582+
unset($GLOBALS['callback_sort_order'], $GLOBALS['callback_sort_by']);
570583

571584
/**
572585
* now apply limit

0 commit comments

Comments
 (0)