Skip to content

Commit

Permalink
b2b_entities: fix crashes after running the script request route
Browse files Browse the repository at this point in the history
After releasing the lock and running the script request route, check
if the dialog has not been deleted in the meantime.

Credits to David Escartin from Sonoc for reporting.

(cherry picked from commit 65a8da4)
  • Loading branch information
rvlad-patrascu committed Feb 6, 2023
1 parent cc2683f commit 1d3448c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions modules/b2b_entities/dlg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,19 @@ int b2b_prescript_f(struct sip_msg *msg, void *uparam)
}
}
B2BE_LOCK_GET(table, hash_index);

/* check if the dialog has not be deleted while not holding the lock */
for(aux_dlg = table[hash_index].first; aux_dlg; aux_dlg = aux_dlg->next)
{
if(aux_dlg == dlg)
break;
}
if(!aux_dlg)
{
LM_DBG("Record not found anymore\n");
B2BE_LOCK_RELEASE(table, hash_index);
return SCB_DROP_MSG;
}
}

if(method_value != METHOD_CANCEL)
Expand Down

0 comments on commit 1d3448c

Please sign in to comment.