Skip to content

Commit

Permalink
b2b_logic: unlink entity in the tuple before destroying
Browse files Browse the repository at this point in the history
This prevents a crash generated while trying to iterate through the
tuple bridging_entities in the local route - since the entity has been
destroyed, but not removed from the tuple, accessing it may cause in
invalid memory access and crashes.

Thanks go to @BTa7BxrHYn on GitHub for reporting it
Close #3240

(cherry picked from commit ae098f7)
  • Loading branch information
razvancrainea committed Nov 20, 2023
1 parent 3ffcf7d commit 91f7ea7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions modules/b2b_logic/bridging.c
Original file line number Diff line number Diff line change
Expand Up @@ -2147,6 +2147,7 @@ int b2bl_bridge_msg(struct sip_msg* msg, str* key, int entity_no, str *adv_ct)
}
old_entity->peer = NULL;

tuple->bridge_entities[(entity_no?0:1)] = NULL;
/* remove the disconected entity from the tuple */
if(0 == b2bl_drop_entity(old_entity, tuple))
{
Expand Down

0 comments on commit 91f7ea7

Please sign in to comment.