Jump to content

Home

basejk bug. will over write varables


orion2486

Recommended Posts

wondering if anyone found this base jk bug, this is in both jk2 and jk3

 

in g_local.h

 

int numTeamVotingClients[2]; // set by CalculateRanks

 

in bg_public.h

enum {

TEAM_FREE,

TEAM_RED,

TEAM_BLUE,

TEAM_SPECTATOR,

 

TEAM_NUM_TEAMS

};

 

in g_main.c, Function CalculateRanks()

 

for (i = 0; i < TEAM_NUM_TEAMS; i++) {

level.numteamVotingClients = 0;

}

 

 

While i was doing bug fixing for JAR 1.4. Getting ready for release, finally. I had right after the declartion of the numteamVotingClients some team locking bools, and i would notice that those bools would randomly get reset to qfalse. taht being the above for loop, loops 4 times while the array is two, thus going out of bounds and overwriting whatever is in the next 8 bytes of memory to zero. I've corrected this for JAR and for the next version of JA Mod, and if anyone else hasn't seen this error here you go. Ive done testing and you can either change the for loop to only execute 2 times, since any instance of that variable is only indexed at 0 and 1, or just make the array a size of 4.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...