Skip to content
Permalink
Browse files Browse the repository at this point in the history
fixed exploit where server crash by spamming team command
********************
ERROR: G_Alloc: failed on allocation of 27248 bytes
********************
----- Server Shutdown (Server crashed: G_Alloc: failed on allocation of 27248 bytes) -----

replaced G_Alloc -> trap_Alloc

anyway POOLSIZE for G_Alloc will fill up quickly just changing team in game menu
  • Loading branch information
Duk0 committed May 27, 2019
1 parent 39bcb1c commit f2cd18b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions code/game/ai_cast_script.c
Expand Up @@ -391,7 +391,7 @@ void AICast_ScriptLoad( void ) {
return;
}

level.scriptAI = G_Alloc( len );
level.scriptAI = trap_Alloc( len );
trap_FS_Read( level.scriptAI, len, f );

trap_FS_FCloseFile( f );
Expand Down Expand Up @@ -518,7 +518,7 @@ void AICast_ScriptParse( cast_state_t *cs ) {
}

if ( strlen( params ) ) { // copy the params into the event
curEvent->params = G_Alloc( strlen( params ) + 1 );
curEvent->params = trap_Alloc( strlen( params ) + 1 );
Q_strncpyz( curEvent->params, params, strlen( params ) + 1 );
}

Expand Down Expand Up @@ -591,7 +591,7 @@ void AICast_ScriptParse( cast_state_t *cs ) {
}

if ( strlen( params ) ) { // copy the params into the event
curEvent->stack.items[curEvent->stack.numItems].params = G_Alloc( strlen( params ) + 1 );
curEvent->stack.items[curEvent->stack.numItems].params = trap_Alloc( strlen( params ) + 1 );
Q_strncpyz( curEvent->stack.items[curEvent->stack.numItems].params, params, strlen( params ) + 1 );
}

Expand Down Expand Up @@ -623,7 +623,7 @@ void AICast_ScriptParse( cast_state_t *cs ) {

// alloc and copy the events into the cast_state_t for this cast
if ( numEventItems > 0 ) {
cs->castScriptEvents = G_Alloc( sizeof( cast_script_event_t ) * numEventItems );
cs->castScriptEvents = trap_Alloc( sizeof( cast_script_event_t ) * numEventItems );
memcpy( cs->castScriptEvents, cast_temp_events, sizeof( cast_script_event_t ) * numEventItems );
cs->numCastScriptEvents = numEventItems;

Expand Down

0 comments on commit f2cd18b

Please sign in to comment.