Module: kamailio
Branch: master
Commit: 83cf034c20137a81dbd4b3572467b7b1f2f6929f
URL:
https://github.com/kamailio/kamailio/commit/83cf034c20137a81dbd4b3572467b7b…
Author: jaybeepee <jason.penton(a)gmail.com>
Committer: jaybeepee <jason.penton(a)gmail.com>
Date: 2016-09-28T17:36:42+02:00
modules/presence: prevent segfault on deref. of empty hashtable entry list
---
Modified: modules/presence/hash.c
---
Diff:
https://github.com/kamailio/kamailio/commit/83cf034c20137a81dbd4b3572467b7b…
Patch:
https://github.com/kamailio/kamailio/commit/83cf034c20137a81dbd4b3572467b7b…
---
diff --git a/modules/presence/hash.c b/modules/presence/hash.c
index bfce59d..32f1f94 100644
--- a/modules/presence/hash.c
+++ b/modules/presence/hash.c
@@ -112,7 +112,7 @@ subs_t* search_shtable(shtable_t htable,str callid,str to_tag,
{
subs_t* s;
- s= htable[hash_code].entries->next;
+ s= htable[hash_code].entries?htable[hash_code].entries->next:NULL;
while(s)
{
@@ -292,7 +292,7 @@ int delete_shtable(shtable_t htable,unsigned int hash_code,subs_t*
subs)
lock_get(&htable[hash_code].lock);
ps= htable[hash_code].entries;
- s= ps->next;
+ s= ps?ps->next:NULL;
while(s)
{