From 83cf034c20137a81dbd4b3572467b7b1f2f6929f Mon Sep 17 00:00:00 2001 From: jaybeepee Date: Wed, 28 Sep 2016 17:36:42 +0200 Subject: [PATCH] modules/presence: prevent segfault on deref. of empty hashtable entry list --- modules/presence/hash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/presence/hash.c b/modules/presence/hash.c index bfce59da387..32f1f94abd1 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) {