From e55e622d2fd36ecf458ce551f1c7dbfe798f5b5c Mon Sep 17 00:00:00 2001 From: Garux Date: Sat, 23 Feb 2019 00:05:25 +0300 Subject: [PATCH] prevent buffer read overflow --- tools/quake3/common/scriplib.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/quake3/common/scriplib.c b/tools/quake3/common/scriplib.c index 3def0d58..b16a2aef 100644 --- a/tools/quake3/common/scriplib.c +++ b/tools/quake3/common/scriplib.c @@ -224,11 +224,8 @@ qboolean GetToken( qboolean crossline ){ // skip space // skipspace: - while ( *script->script_p <= 32 ) + while ( script->script_p < script->end_p && *script->script_p <= 32 ) { - if ( script->script_p >= script->end_p ) { - return EndOfScript( crossline ); - } if ( *script->script_p++ == '\n' ) { if ( !crossline ) { Error( "Line %i is incomplete\nFile location be: %s\n", scriptline, g_strLoadedFileLocation );