Authors: Tony Lambregts <tony_lambregts@telusplanet.net>, Jonathan Ernst <Jonathan@ernstfamily.ch>, Paul van Schayck <polleke@gmail.com>

Protect addmsg() from using up all available memory and crashing
This commit is contained in:
WineHQ
2005-01-15 06:02:01 +00:00
parent 30aeda85d6
commit 7d67786b96

View File

@@ -4,6 +4,7 @@
/*************************************************/ /*************************************************/
// get modules // get modules
ini_set("memory_limit","64M");
require(BASE."include/"."config.php"); require(BASE."include/"."config.php");
require(BASE."include/"."util.php"); require(BASE."include/"."util.php");
require(BASE."include/"."user.php"); require(BASE."include/"."user.php");
@@ -180,12 +181,18 @@ function redirectref($url = null)
*/ */
function addmsg($text, $color = "black") function addmsg($text, $color = "black")
{ {
global $hAppdbLink;
if($color) if($color)
$text = "<font color='$color'> $text </font>\n"; $text = "<font color='$color'> $text </font>\n";
$text = str_replace("'", "\\'", $text); $text = addslashes($text);
query_appdb("INSERT INTO sessionMessages VALUES (null, null, '".session_id()."', '$text')"); $sQuery = "INSERT INTO sessionMessages VALUES (null, null, '".session_id()."', '$text')";
echo mysql_error(); if (!mysql_query($sQuery,$hAppdbLink))
{
echo "An error has occured in addmsg(): ".mysql_error($hAppdbLink);
echo $text;
}
} }