From: havoc Date: Wed, 25 Aug 2004 08:55:00 +0000 (+0000) Subject: fixed a couple potential crashes due to nodestack overflow, as suggested by Vic X-Git-Tag: xonotic-v0.1.0preview~5699 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c05bdc5c0dddcabf4d0965f17426a9b8c2b8a668;p=xonotic%2Fdarkplaces.git fixed a couple potential crashes due to nodestack overflow, as suggested by Vic git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4378 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/model_brush.c b/model_brush.c index 45b5340f..591e9ef4 100644 --- a/model_brush.c +++ b/model_brush.c @@ -126,7 +126,8 @@ static int Mod_Q1BSP_BoxTouchingPVS(model_t *model, const qbyte *pvs, const vec3 else { // box crosses plane, take one path and remember the other - nodestack[nodestackindex++] = node->children[0]; + if (nodestackindex < 1024) + nodestack[nodestackindex++] = node->children[0]; node = node->children[1]; } } @@ -5343,7 +5344,8 @@ static int Mod_Q3BSP_BoxTouchingPVS(model_t *model, const qbyte *pvs, const vec3 else { // box crosses plane, take one path and remember the other - nodestack[nodestackindex++] = node->children[0]; + if (nodestackindex < 1024) + nodestack[nodestackindex++] = node->children[0]; node = node->children[1]; } }