Skip to content

Commit 1a6fb8a

Browse files
committed
Fix another memory clobbering issue. (dereferenced pointer)
Patch Author: Safety0ff fixes ticket:2300 Original detective work done by Ai_Tak (ticket:1656) Signed-off-by: buginator <buginator@gna.org>
1 parent d4639fe commit 1a6fb8a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/script/event.c

+6-4
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,7 @@ static void eventFreeTrigger(ACTIVE_TRIGGER *psTrigger)
974974
// Activate a callback trigger
975975
void eventFireCallbackTrigger(TRIGGER_TYPE callback)
976976
{
977-
ACTIVE_TRIGGER *psPrev = NULL, *psCurr, *psNext;
977+
ACTIVE_TRIGGER *psPrev = NULL, *psCurr, *psNext, **ppsNext;
978978
TRIGGER_DATA *psTrigDat;
979979
BOOL fired;
980980

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

987987
//this can be called from eventProcessTriggers and so will wipe out all the current added ones
988988
//psAddedTriggers = NULL;
989-
for (psCurr = psCallbackList; psCurr && psCurr->type <= (int)callback; psCurr = psNext)
989+
for (psCurr = psCallbackList; psCurr && psCurr->type <= (int)callback; psCurr = *ppsNext)
990990
{
991-
psNext = psCurr->psNext;
991+
ppsNext = &psCurr->psNext;
992992
if (psCurr->type == (int)callback)
993993
{
994994
// see if the callback should be fired
@@ -1035,10 +1035,12 @@ void eventFireCallbackTrigger(TRIGGER_TYPE callback)
10351035
if (psPrev == NULL)
10361036
{
10371037
psCallbackList = psCallbackList->psNext;
1038+
ppsNext = &psCallbackList;
10381039
}
10391040
else
10401041
{
1041-
psPrev->psNext = psNext;
1042+
psPrev->psNext = *ppsNext;
1043+
ppsNext = &psPrev->psNext;
10421044
}
10431045

10441046
triggerChanged = false;

0 commit comments

Comments
 (0)