From c05bdc5c0dddcabf4d0965f17426a9b8c2b8a668 Mon Sep 17 00:00:00 2001 From: havoc Date: Wed, 25 Aug 2004 08:55:00 +0000 Subject: [PATCH] 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 --- model_brush.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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]; } } -- 2.39.2