Skip to content

Commit

Permalink
Try to fix wrong stripping of request variables
Browse files Browse the repository at this point in the history
- the list of walked array keys can not be static as this can prevent of
  processing of some elements
- we need to flag all processed elements as after reordering they can
  come again
  • Loading branch information
nijel committed Apr 10, 2014
1 parent a3e05a3 commit 295e688
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libraries/core.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -442,15 +442,17 @@ function PMA_arrayMergeRecursive()
*/
function PMA_arrayWalkRecursive(&$array, $function, $apply_to_keys_also = false)
{
static $walked_keys = array();
static $recursive_counter = 0;
$walked_keys = array();

if (++$recursive_counter > 1000) {
PMA_fatalError(__('possible deep recursion attack'));
}
foreach ($array as $key => $value) {
if (isset($walked_keys[$key])) {
continue;
}
$walked_keys[$key] = true;

if (is_array($value)) {
PMA_arrayWalkRecursive($array[$key], $function, $apply_to_keys_also);
Expand All @@ -464,8 +466,6 @@ function PMA_arrayWalkRecursive(&$array, $function, $apply_to_keys_also = false)
$array[$new_key] = $array[$key];
unset($array[$key]);
$walked_keys[$new_key] = true;
} else {
$walked_keys[$key] = true;
}
}
}
Expand Down

0 comments on commit 295e688

Please sign in to comment.