mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
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:
parent
ae65ba0013
commit
d095ebf9b2
1 changed files with 5 additions and 5 deletions
|
@ -1098,17 +1098,17 @@ void Net_SaveMapState(netmapstate_t *save)
|
||||||
i = headspritestat[g_netStatnums[statIndex]];
|
i = headspritestat[g_netStatnums[statIndex]];
|
||||||
for (; i >= 0; i = nextspritestat[i])
|
for (; i >= 0; i = nextspritestat[i])
|
||||||
{
|
{
|
||||||
|
if (save->numActors >= NETMAXACTORS)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (Net_IsRelevantSprite(i) && sprite[i].statnum != STAT_NETALLOC)
|
if (Net_IsRelevantSprite(i) && sprite[i].statnum != STAT_NETALLOC)
|
||||||
{
|
{
|
||||||
netactor_t *tempActor = &save->actor[save->numActors];
|
netactor_t *tempActor = &save->actor[save->numActors];
|
||||||
Net_CopyToNet(i, tempActor);
|
Net_CopyToNet(i, tempActor);
|
||||||
save->numActors++;
|
save->numActors++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (save->numActors >= NETMAXACTORS)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue