Skip to content

Commit

Permalink
Fix another memory clobbering issue. (dereferenced pointer)
Browse files Browse the repository at this point in the history
Patch Author: Safety0ff
fixes ticket:2300

Original detective work done by Ai_Tak (ticket:1656)

Signed-off-by: buginator <buginator@gna.org>
  • Loading branch information
buginator committed Nov 9, 2010
1 parent d4639fe commit 1a6fb8a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/script/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,7 @@ static void eventFreeTrigger(ACTIVE_TRIGGER *psTrigger)
// Activate a callback trigger
void eventFireCallbackTrigger(TRIGGER_TYPE callback)
{
ACTIVE_TRIGGER *psPrev = NULL, *psCurr, *psNext;
ACTIVE_TRIGGER *psPrev = NULL, *psCurr, *psNext, **ppsNext;
TRIGGER_DATA *psTrigDat;
BOOL fired;

Expand All @@ -986,9 +986,9 @@ void eventFireCallbackTrigger(TRIGGER_TYPE callback)

//this can be called from eventProcessTriggers and so will wipe out all the current added ones
//psAddedTriggers = NULL;
for (psCurr = psCallbackList; psCurr && psCurr->type <= (int)callback; psCurr = psNext)
for (psCurr = psCallbackList; psCurr && psCurr->type <= (int)callback; psCurr = *ppsNext)
{
psNext = psCurr->psNext;
ppsNext = &psCurr->psNext;
if (psCurr->type == (int)callback)
{
// see if the callback should be fired
Expand Down Expand Up @@ -1035,10 +1035,12 @@ void eventFireCallbackTrigger(TRIGGER_TYPE callback)
if (psPrev == NULL)
{
psCallbackList = psCallbackList->psNext;
ppsNext = &psCallbackList;
}
else
{
psPrev->psNext = psNext;
psPrev->psNext = *ppsNext;
ppsNext = &psPrev->psNext;
}

triggerChanged = false;
Expand Down

0 comments on commit 1a6fb8a

Please sign in to comment.