net.c: move a necessary bound check to BEFORE the oob access happening.

Fixes the undefined behavior discussed here:
http://forums.duke4.net/topic/3857-the-crash-thread/page__view__findpost__p__152612

git-svn-id: https://svn.eduke32.com/eduke32@4008 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-08-12 15:18:10 +00:00
parent ae65ba0013
commit d095ebf9b2

View file

@ -1098,17 +1098,17 @@ void Net_SaveMapState(netmapstate_t *save)
i = headspritestat[g_netStatnums[statIndex]];
for (; i >= 0; i = nextspritestat[i])
{
if (save->numActors >= NETMAXACTORS)
{
break;
}
if (Net_IsRelevantSprite(i) && sprite[i].statnum != STAT_NETALLOC)
{
netactor_t *tempActor = &save->actor[save->numActors];
Net_CopyToNet(i, tempActor);
save->numActors++;
}
if (save->numActors >= NETMAXACTORS)
{
break;
}
}
}