Module: kamailio
Branch: master
Commit: ada2d37e0432e3044582f65d0ac5d677df66a10a
URL: 
https://github.com/kamailio/kamailio/commit/ada2d37e0432e3044582f65d0ac5d677df66a10a

Author: Viktor Litvinov <viktor.litvi...@net2phone.com>
Committer: Henning Westerholt <h...@gilawa.com>
Date: 2025-08-19T13:45:30+02:00

presence: segfault on presentity replace

---

Modified: src/modules/presence/hash.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/ada2d37e0432e3044582f65d0ac5d677df66a10a.diff
Patch: 
https://github.com/kamailio/kamailio/commit/ada2d37e0432e3044582f65d0ac5d677df66a10a.patch

---

diff --git a/src/modules/presence/hash.c b/src/modules/presence/hash.c
index 9b68c18836d..3a0f594e6b7 100644
--- a/src/modules/presence/hash.c
+++ b/src/modules/presence/hash.c
@@ -1058,6 +1058,7 @@ int ps_ptable_replace(ps_presentity_t *ptm, 
ps_presentity_t *pt)
        ps_presentity_t ptc;
        ps_presentity_t ptv;
        ps_presentity_t *ptn = NULL;
+       ps_presentity_t *ptnx = NULL;
        uint32_t idx = 0;
 
        /* copy struct to fill in missing fields */
@@ -1088,9 +1089,12 @@ int ps_ptable_replace(ps_presentity_t *ptm, 
ps_presentity_t *pt)
                        } else {
                                _ps_ptable->slots[idx].plist = ptn->next;
                        }
+                       ptnx = ptn->next;
                        ps_presentity_free(ptn, 0);
+                       ptn = ptnx;
+               } else {
+                       ptn = ptn->next;
                }
-               ptn = ptn->next;
        }
 
        ptn = ps_presentity_new(&ptv, 0);

_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to