|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-10-30 22:54 UTC] yoyahack at undersecurity dot net
Description:
------------
If income mysql_fetch_assoc (mysql_query (SQL) within a while loop cause denial
of service
Test script:
---------------
<?php
$link = mysql_connect('127.0.0.1','user', 'pass');
mysql_select_db('db', $link);
while($row = mysql_fetch_assoc(mysql_query('select * from table', $link)))
{
echo $row['id'];
}
?>
Expected result:
----------------
it generates an infinite loop that never ends
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 08 03:00:02 2025 UTC |
hi,buddy, in my thought,you just have a structure mistake,because in while loop,it have to have a static value,but your argument is a dynamic generated,so everytime anyhow the while loop is true,and each output record is the first item in your table,except your table is empty.solve it below: $link = mysql_connect('127.0.0.1','root', 'root'); mysql_select_db('test', $link); $resouce = mysql_query('select * from table', $link); while($row = mysql_fetch_assoc($resource)) { echo $row['col1'].nl2br('/r'); }