2014-06-04, 19:01:15
Hi,
just found a nasty bug someone used to dos my webserver.
In calendar/inc/calendar.php:10 there is a loop iterating over an check for a valid date to determine the number of days in a given month of a year.
When a page is accessed with a ridiculous low value (e.g. 1387), this loop never ends.
Problem:
$days = 31;
while (!checkdate($month, $days, $year)) $days--;
return $days;
Solution:
$days = 31;
while ($days > 0 && !checkdate($month, $days, $year)) $days--;
return $days;
Regards,
Simon
just found a nasty bug someone used to dos my webserver.
In calendar/inc/calendar.php:10 there is a loop iterating over an check for a valid date to determine the number of days in a given month of a year.
When a page is accessed with a ridiculous low value (e.g. 1387), this loop never ends.
Problem:
$days = 31;
while (!checkdate($month, $days, $year)) $days--;
return $days;
Solution:
$days = 31;
while ($days > 0 && !checkdate($month, $days, $year)) $days--;
return $days;
Regards,
Simon