[sr-dev] git:3.3: modules_k/presence: Fixed segmentation fault when uploading pres-rules documents
Peter Dunkley
peter.dunkley at crocodile-rcs.com
Thu Jun 14 13:11:40 CEST 2012
Module: sip-router
Branch: 3.3
Commit: 3dba329bbefb4ef4274642eff722278c22387784
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=3dba329bbefb4ef4274642eff722278c22387784
Author: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Date: Thu Jun 14 12:10:35 2012 +0100
modules_k/presence: Fixed segmentation fault when uploading pres-rules documents
- Found and fixed by Hugh Waite @ Crocodile RCS
(cherry picked from commit 9dbe8f9fdff1eb5718698cdcdf2357ee1fabd42b)
---
modules_k/presence/presence.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/modules_k/presence/presence.c b/modules_k/presence/presence.c
index f8ba258..95a7127 100644
--- a/modules_k/presence/presence.c
+++ b/modules_k/presence/presence.c
@@ -949,6 +949,7 @@ int update_watchers_status(str pres_uri, pres_ev_t* ev, str* rules_doc)
}
}
+ memset(&subs, 0, sizeof(subs_t));
subs.pres_uri= pres_uri;
subs.event= ev;
subs.auth_rules_doc= rules_doc;
@@ -1406,11 +1407,18 @@ static int update_pw_dialogs_dbonlymode(subs_t* subs, subs_t** subs_array)
db_cols[n_update_cols] = &str_updated_col;
db_vals[n_update_cols].type = DB1_INT;
- db_vals[n_update_cols].nul = 0;
- db_vals[n_update_cols].val.int_val =
- core_hash(&subs->callid, &subs->from_tag,
+ db_vals[n_update_cols].nul = 0;
+ if (subs->callid.len == 0 || subs->from_tag.len == 0)
+ {
+ db_vals[n_update_cols].val.int_val = (int) ((rand() / (RAND_MAX + 1.0)) *
(pres_waitn_time * pres_notifier_poll_rate
+ * pres_notifier_processes));
+ } else {
+ db_vals[n_update_cols].val.int_val =
+ core_hash(&subs->callid, &subs->from_tag,
+ (pres_waitn_time * pres_notifier_poll_rate
* pres_notifier_processes) - 1);
+ }
n_update_cols++;
More information about the sr-dev
mailing list