From: havoc Date: Thu, 21 Oct 2004 08:45:59 +0000 (+0000) Subject: don't allow Log_ConPrint to recurse into itself, as can happen with a memory corrupti... X-Git-Tag: xonotic-v0.1.0preview~5440 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=bd308145f125050fd00e24a6464351a47efec2a1;p=xonotic%2Fdarkplaces.git don't allow Log_ConPrint to recurse into itself, as can happen with a memory corruption report -> Log_ConPrint -> memory corruption report -> Log_ConPrint -> ... git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4684 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/console.c b/console.c index 8020de1b..e9c8797e 100644 --- a/console.c +++ b/console.c @@ -201,6 +201,11 @@ Log_ConPrint */ void Log_ConPrint (const char *msg) { + static qboolean inprogress = false; + // don't allow feedback loops with memory error reports + if (inprogress) + return; + inprogress = true; // Until the host is completely initialized, we maintain a log queue // to store the messages, since the log can't be started before if (logqueue != NULL) @@ -224,6 +229,7 @@ void Log_ConPrint (const char *msg) memcpy (&logqueue[logq_ind], msg, len); logq_ind += len; + inprogress = false; return; } @@ -241,6 +247,7 @@ void Log_ConPrint (const char *msg) if (log_sync.integer) FS_Flush (logfile); } + inprogress = false; }