Hi,
In this bug: http://sourceforge.net/tracker/index.php?func=detail&aid=1709463&gro...
there are many fields involved and we get a false alarm "possible deep recursion attack". Do we really need to protect from 1000 recursions overall? I think that protecting from 1000 recursions for each superglobal would be correct.
Proposed patch which resets the recursive counter:
Index: common.lib.php =================================================================== --- common.lib.php (revision 10333) +++ common.lib.php (working copy) @@ -269,9 +269,12 @@ * @param array $array array to walk * @param string $function function to call for every array element */ -function PMA_arrayWalkRecursive(&$array, $function, $apply_to_keys_also = false) +function PMA_arrayWalkRecursive(&$array, $function, $apply_to_keys_also = false, $reset_static = false) { static $recursive_counter = 0; + if ($reset_static) { + $recursive_counter = 0; + } if (++$recursive_counter > 1000) { die('possible deep recursion attack'); } @@ -2604,10 +2607,10 @@
// remove quotes added by php if (get_magic_quotes_gpc()) { - PMA_arrayWalkRecursive($_GET, 'stripslashes', true); - PMA_arrayWalkRecursive($_POST, 'stripslashes', true); - PMA_arrayWalkRecursive($_COOKIE, 'stripslashes', true); - PMA_arrayWalkRecursive($_REQUEST, 'stripslashes', true); + PMA_arrayWalkRecursive($_GET, 'stripslashes', true, true); + PMA_arrayWalkRecursive($_POST, 'stripslashes', true, true); + PMA_arrayWalkRecursive($_COOKIE, 'stripslashes', true, true); + PMA_arrayWalkRecursive($_REQUEST, 'stripslashes', true, true); } /** * In some cases, this one is not set
Marc Delisle schrieb:
Hi,
In this bug: http://sourceforge.net/tracker/index.php?func=detail&aid=1709463&gro...
there are many fields involved and we get a false alarm "possible deep recursion attack". Do we really need to protect from 1000 recursions overall? I think that protecting from 1000 recursions for each superglobal would be correct.
as it should do currently with
core.lib.php#474:
$recursive_counter--;
Sebastian Mendel schrieb:
Marc Delisle schrieb:
Hi,
In this bug: http://sourceforge.net/tracker/index.php?func=detail&aid=1709463&gro...
there are many fields involved and we get a false alarm "possible deep recursion attack". Do we really need to protect from 1000 recursions overall? I think that protecting from 1000 recursions for each superglobal would be correct.
as it should do currently with
core.lib.php#474:
$recursive_counter--;
sorry, i really have currently very short time, thats why i do not have taken o look nto it, but keep in mind - it should count only into the deep:
as this will not count:
$array[a0001] = ... $array[a0002] = ... $array[a0003] = ... ... $array[a1000] = ...
but only this:
$array[][][][][][][][]...[]
so it confuses me that this limit of 1000 is reached, even for a big table ...
Sebastian Mendel a écrit :
Marc Delisle schrieb:
Hi,
In this bug: http://sourceforge.net/tracker/index.php?func=detail&aid=1709463&gro...
there are many fields involved and we get a false alarm "possible deep recursion attack". Do we really need to protect from 1000 recursions overall? I think that protecting from 1000 recursions for each superglobal would be correct.
as it should do currently with
core.lib.php#474:
$recursive_counter--;
Ok, in 2.10.x this is $recursive_counter++;
I'll backport this fix from trunk.
Marc