summaryrefslogtreecommitdiff
path: root/pjnath
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2008-09-02 07:40:34 +0000
committerBenny Prijono <bennylp@teluu.com>2008-09-02 07:40:34 +0000
commit9f6611d9776676a4e71836a8ef94645ce0007f77 (patch)
tree454f1d10e19845841b594de5bfdda9d977bfa7ad /pjnath
parent66cd18b63975465e7def01de245839121b24d9f6 (diff)
Fixed ticket #607: Assertion and possibly crash in ICE stream transport when client is not behind NAT (thanks Nicolas Fauvel for the report)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2258 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjnath')
-rw-r--r--pjnath/src/pjnath/ice_strans.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/pjnath/src/pjnath/ice_strans.c b/pjnath/src/pjnath/ice_strans.c
index caaa5598..cb03af84 100644
--- a/pjnath/src/pjnath/ice_strans.c
+++ b/pjnath/src/pjnath/ice_strans.c
@@ -1287,8 +1287,18 @@ static pj_bool_t stun_on_status(pj_stun_sock *stun_sock,
if (dup) {
/* Duplicate found, remove the srflx candidate */
+ unsigned idx = cand - comp->cand_list;
+
+ /* Update default candidate index */
+ if (comp->default_cand > idx) {
+ --comp->default_cand;
+ } else if (comp->default_cand == idx) {
+ comp->default_cand = 0;
+ }
+
+ /* Remove srflx candidate */
pj_array_erase(comp->cand_list, sizeof(comp->cand_list[0]),
- comp->cand_cnt, cand - comp->cand_list);
+ comp->cand_cnt, idx);
--comp->cand_cnt;
} else {
/* Otherwise update the address */