aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-10-20 16:14:05 +0000
committertma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-10-20 16:14:05 +0000
commitb909162456a295e3b7c098d53735a231a3ff1069 (patch)
treec4073c73980e5cbd802d038d7be6d8cb545242e6
parentb8dbaee591491f9336b57a996374989361651c61 (diff)
downloadioquake3-aero-b909162456a295e3b7c098d53735a231a3ff1069.tar.gz
ioquake3-aero-b909162456a295e3b7c098d53735a231a3ff1069.zip
* Fix to buffer overflow in lightmap loading code from misanthropia
git-svn-id: svn://svn.icculus.org/quake3/trunk@169 edf5b092-35ff-0310-97b2-ce42778d08ea
-rw-r--r--code/renderer/tr_bsp.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/code/renderer/tr_bsp.c b/code/renderer/tr_bsp.c
index 217a3d8..f6e9691 100644
--- a/code/renderer/tr_bsp.c
+++ b/code/renderer/tr_bsp.c
@@ -140,7 +140,7 @@ static void R_LoadLightmaps( lump_t *l ) {
float maxIntensity = 0;
double sumIntensity = 0;
- len = l->filelen;
+ len = l->filelen;
if ( !len ) {
return;
}
@@ -155,6 +155,9 @@ static void R_LoadLightmaps( lump_t *l ) {
//FIXME: HACK: maps with only one lightmap turn up fullbright for some reason.
//this avoids this, but isn't the correct solution.
tr.numLightmaps++;
+ } else if ( tr.numLightmaps >= MAX_LIGHTMAPS ) { // 20051020 misantropia
+ ri.Printf( PRINT_WARNING, "WARNING: number of lightmaps > MAX_LIGHTMAPS\n" );
+ tr.numLightmaps = MAX_LIGHTMAPS;
}
// if we are in r_vertexLight mode, we don't need the lightmaps at all