[OpenSIPS-Devel] [opensips] Possible hash_entry, hash_id duplicate due to bad loading of dialogs at startup (#304)

miko95 notifications at github.com
Mon Aug 18 23:24:55 CEST 2014


Hi,

In the load_dialog_info_from_db function (dlg_db_handler.c), the following block may be problematic:

dlg->h_id = hash_id;
next_id = d_table->entries[dlg->h_entry].next_id;
d_table->entries[dlg->h_entry].next_id = (next_id < dlg->h_id) ? (dlg->h_id + 1) : next_id;

At startup, assume d_table->entries[5].next_id is initialized at 25 (see function init_dlg_table in dlg_hash.c) and assume you have only one dialog in the database with hash_entry=5 and hash_id=25. Since the condition next_id < dlg->h_id is false (because next_id == dlg->h_id == 25), the next available hash_id for a future dialog that matches this entry will be 25. Therefore, there will be duplicated (hash_entry,hash_id) which will cause errors when the dialog is inserted in the database.

I guess replacing the condition next_id < dlg->h_id by next_id =< dlg->h_id should solve the issue?

Regards,
Mickael

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/issues/304
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/devel/attachments/20140818/d4e8dbd4/attachment.htm>


More information about the Devel mailing list