Module: kamailio
Branch: 5.5
Commit: b0a327f79d14d1c40742ba1177dd5bdcffc02c6d
URL:
https://github.com/kamailio/kamailio/commit/b0a327f79d14d1c40742ba1177dd5bd…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-02-14T13:03:08+01:00
presence: safety checks for user and domain in ps_ptable_search()
- GH #3008
(cherry picked from commit c47ec08d8d4a14dc190091ccb79ace62ea6674e3)
---
Modified: src/modules/presence/hash.c
---
Diff:
https://github.com/kamailio/kamailio/commit/b0a327f79d14d1c40742ba1177dd5bd…
Patch:
https://github.com/kamailio/kamailio/commit/b0a327f79d14d1c40742ba1177dd5bd…
---
diff --git a/src/modules/presence/hash.c b/src/modules/presence/hash.c
index c313b01cf0..5d0f0a9568 100644
--- a/src/modules/presence/hash.c
+++ b/src/modules/presence/hash.c
@@ -1247,6 +1247,11 @@ ps_presentity_t *ps_ptable_search(ps_presentity_t *ptm, int mmode,
int rmode)
uint32_t idx = 0;
int pmax = 0;
+ if(ptm->user.s==NULL || ptm->domain.s==NULL) {
+ LM_WARN("no user or domain for presentity\n");
+ return NULL;
+ }
+
ptm->hashid = core_case_hash(&ptm->user, &ptm->domain, 0);
idx = core_hash_idx(ptm->hashid, _ps_ptable->ssize);