Welcome Guest, Not a member yet? Register   Sign In
Infinite loop using CAPTCHA captcha helper.php. CodeIgniter 3.03
#1

In the following code when entering the break option. An infinite loop is given and not continuing the application (File ..system/core/helpers/captcha_helper.php) version 3.03:

$byte_index = $word_index = 0;
while ($word_index < $word_length)
{
//echo "wi = " . $word_index . "wl = " . $word_length . " \n";
if (($rand_index = unpack('C', $bytes[$byte_index++])) > $rand_max)
{
// Was this the last byte we have?
// If so, try to fetch more.
if ($byte_index === $pool_length)
{
// No failures should be possible if
// the first get_random_bytes() call
// didn't return FALSE, but still ...
for ($i = 0; $i < 5; $i++)
{
if (($bytes = $security->get_random_bytes($pool_length)) === FALSE)
{
continue;
}

$byte_index = 0;
break;
}

if ($bytes === FALSE)
{
// Sadly, this means fallback to mt_rand()
$word = '';
break;
}
}

continue;
}

$word .= $pool[$rand_index];
$word_index++;
}
Reply


Messages In This Thread
Infinite loop using CAPTCHA captcha helper.php. CodeIgniter 3.03 - by aloewens - 11-04-2015, 08:34 PM



Theme © iAndrew 2016 - Forum software by © MyBB