Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use after free #402

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/actarrow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#define ARROW_OLDY my->fskill[3]
#define ARROW_MAXLIFE 600

void actArrow(Entity* my)
bool actArrow(Entity* my)
{
double dist;
int damage;
Expand All @@ -57,7 +57,7 @@ void actArrow(Entity* my)
if ( ARROW_LIFE >= ARROW_MAXLIFE )
{
list_RemoveNode(my->mynode);
return;
return false;
}

if ( !ARROW_STUCK )
Expand Down Expand Up @@ -97,7 +97,7 @@ void actArrow(Entity* my)
if ( parent && parent->checkFriend(hit.entity) )
{
list_RemoveNode(my->mynode);
return;
return false;
}
}

Expand Down Expand Up @@ -341,4 +341,6 @@ void actArrow(Entity* my)
}
}
}

return true;
}
10 changes: 6 additions & 4 deletions src/actarrowtrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#define ARROWTRAP_FIRED my->skill[0]
#define ARROWTRAP_AMBIENCE my->skill[6]

void actArrowTrap(Entity* my)
bool actArrowTrap(Entity* my)
{
int x, y;
int c;
Expand All @@ -40,12 +40,12 @@ void actArrowTrap(Entity* my)
if ( !map.tiles[OBSTACLELAYER + checky * MAPLAYERS + checkx * MAPLAYERS * map.height] ) // wall
{
list_RemoveNode(my->mynode);
return;
return false;
}
if ( ARROWTRAP_FIRED == 1 ) // shot my piece, time to die.
{
list_RemoveNode(my->mynode);
return;
return false;
}

ARROWTRAP_AMBIENCE--;
Expand All @@ -57,7 +57,7 @@ void actArrowTrap(Entity* my)

if ( !my->skill[28] )
{
return;
return true;
}

// received on signal
Expand Down Expand Up @@ -111,4 +111,6 @@ void actArrowTrap(Entity* my)
}
}
}

return true;
}
16 changes: 9 additions & 7 deletions src/actbeartrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#define BEARTRAP_APPEARANCE my->skill[14]
#define BEARTRAP_IDENTIFIED my->skill[15]

void actBeartrap(Entity* my)
bool actBeartrap(Entity* my)
{
int i;
if ( my->sprite == 667 )
Expand All @@ -46,7 +46,7 @@ void actBeartrap(Entity* my)

if ( multiplayer == CLIENT )
{
return;
return true;
}

// undo beartrap
Expand Down Expand Up @@ -79,14 +79,14 @@ void actBeartrap(Entity* my)
entity->itemNotMovingClient = 1;
messagePlayer(i, language[1300]);
list_RemoveNode(my->mynode);
return;
return false;
}
}
}

if ( BEARTRAP_CAUGHT == 1 )
{
return;
return true;
}

// launch beartrap
Expand Down Expand Up @@ -219,25 +219,27 @@ void actBeartrap(Entity* my)
entity->pitch = my->pitch;
entity->roll = PI;
list_RemoveNode(my->mynode);
return false;
}
else
{
BEARTRAP_CAUGHT = 1;
my->sprite = 667;
serverUpdateEntitySkill(my, 0);
return true;
}
return;
}
}
}
}
}

void actBeartrapLaunched(Entity* my)
bool actBeartrapLaunched(Entity* my)
{
if ( my->ticks >= 200 )
{
list_RemoveNode(my->mynode);
return;
return false;
}
return true;
}
44 changes: 25 additions & 19 deletions src/actboulder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ int boulderCheckAgainstEntity(Entity* my, Entity* entity)

-------------------------------------------------------------------------------*/

void actBoulder(Entity* my)
bool actBoulder(Entity* my)
{
int i;

Expand Down Expand Up @@ -337,7 +337,7 @@ void actBoulder(Entity* my)
{
boulderSokobanOnDestroy(true);
}
return;
return false;
}
if ( !BOULDER_NOGROUND )
{
Expand All @@ -357,7 +357,7 @@ void actBoulder(Entity* my)
}
if ( boulderCheckAgainstEntity(my, entity) )
{
return;
return true;
}
}
}
Expand Down Expand Up @@ -465,7 +465,7 @@ void actBoulder(Entity* my)
}
if ( boulderCheckAgainstEntity(my, entity) )
{
return;
return true;
}
}
}
Expand Down Expand Up @@ -651,7 +651,7 @@ void actBoulder(Entity* my)
}
if ( boulderCheckAgainstEntity(my, entity) )
{
return;
return true;
}
}
}
Expand Down Expand Up @@ -730,12 +730,13 @@ void actBoulder(Entity* my)
{
--BOULDER_BLOODTIME;
}
return true;
}

#define BOULDERTRAP_FIRED my->skill[0]
#define BOULDERTRAP_AMBIENCE my->skill[6]

void actBoulderTrap(Entity* my)
bool actBoulderTrap(Entity* my)
{
int x, y;
int c;
Expand All @@ -749,7 +750,7 @@ void actBoulderTrap(Entity* my)

if ( !my->skill[28] )
{
return;
return true;
}

// received on signal
Expand Down Expand Up @@ -838,9 +839,10 @@ void actBoulderTrap(Entity* my)
}
}
}
return true;
}

void actBoulderTrapEast(Entity* my)
bool actBoulderTrapEast(Entity* my)
{
int x, y;
int c;
Expand All @@ -864,7 +866,7 @@ void actBoulderTrapEast(Entity* my)

if ( !my->skill[28] )
{
return;
return true;
}

// received on signal
Expand All @@ -875,7 +877,7 @@ void actBoulderTrapEast(Entity* my)
if ( my->boulderTrapPreDelay > 0 )
{
--my->boulderTrapPreDelay;
return;
return true;
}
playSoundEntity(my, 150, 128);
for ( c = 0; c < MAXPLAYERS; c++ )
Expand Down Expand Up @@ -926,9 +928,10 @@ void actBoulderTrapEast(Entity* my)
}
}
}
return true;
}

void actBoulderTrapSouth(Entity* my)
bool actBoulderTrapSouth(Entity* my)
{
int x, y;
int c;
Expand All @@ -952,7 +955,7 @@ void actBoulderTrapSouth(Entity* my)

if ( !my->skill[28] )
{
return;
return true;
}

// received on signal
Expand All @@ -963,7 +966,7 @@ void actBoulderTrapSouth(Entity* my)
if ( my->boulderTrapPreDelay > 0 )
{
--my->boulderTrapPreDelay;
return;
return true;
}
playSoundEntity(my, 150, 128);
for ( c = 0; c < MAXPLAYERS; c++ )
Expand Down Expand Up @@ -1014,9 +1017,10 @@ void actBoulderTrapSouth(Entity* my)
}
}
}
return true;
}

void actBoulderTrapWest(Entity* my)
bool actBoulderTrapWest(Entity* my)
{
int x, y;
int c;
Expand All @@ -1040,7 +1044,7 @@ void actBoulderTrapWest(Entity* my)

if ( !my->skill[28] )
{
return;
return true;
}

// received on signal
Expand All @@ -1051,7 +1055,7 @@ void actBoulderTrapWest(Entity* my)
if ( my->boulderTrapPreDelay > 0 )
{
--my->boulderTrapPreDelay;
return;
return true;
}
playSoundEntity(my, 150, 128);
for ( c = 0; c < MAXPLAYERS; c++ )
Expand Down Expand Up @@ -1103,9 +1107,10 @@ void actBoulderTrapWest(Entity* my)
}
}
}
return true;
}

void actBoulderTrapNorth(Entity* my)
bool actBoulderTrapNorth(Entity* my)
{
int x, y;
int c;
Expand All @@ -1129,7 +1134,7 @@ void actBoulderTrapNorth(Entity* my)

if ( !my->skill[28] )
{
return;
return true;
}

// received on signal
Expand All @@ -1140,7 +1145,7 @@ void actBoulderTrapNorth(Entity* my)
if ( my->boulderTrapPreDelay > 0 )
{
--my->boulderTrapPreDelay;
return;
return true;
}
playSoundEntity(my, 150, 128);
for ( c = 0; c < MAXPLAYERS; c++ )
Expand Down Expand Up @@ -1191,6 +1196,7 @@ void actBoulderTrapNorth(Entity* my)
}
}
}
return true;
}

void boulderSokobanOnDestroy(bool pushedOffLedge)
Expand Down
3 changes: 2 additions & 1 deletion src/actcampfire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#define CAMPFIRE_INIT my->skill[4]
#define CAMPFIRE_SOUNDTIME my->skill[5]

void actCampfire(Entity* my)
bool actCampfire(Entity* my)
{
Entity* entity;
int i;
Expand Down Expand Up @@ -132,4 +132,5 @@ void actCampfire(Entity* my)
}
}
}
return true;
}
Loading