Module: kamailio Branch: 4.3 Commit: 583dc060e89b87bcba241edcedd8d48413640fc1 URL: https://github.com/kamailio/kamailio/commit/583dc060e89b87bcba241edcedd8d484...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2015-11-27T14:37:42+01:00
pv: fix for $expires() variables
- invalid while iterator was used, resulting in crash - reported by Jayesh Nambiar
(cherry picked from commit 3fe7fd27605ed9f506a95d11d4c88b78f22eadd1)
---
Modified: modules/pv/pv_core.c
---
Diff: https://github.com/kamailio/kamailio/commit/583dc060e89b87bcba241edcedd8d484... Patch: https://github.com/kamailio/kamailio/commit/583dc060e89b87bcba241edcedd8d484...
---
diff --git a/modules/pv/pv_core.c b/modules/pv/pv_core.c index 7c3aa92..e4a910b 100644 --- a/modules/pv/pv_core.c +++ b/modules/pv/pv_core.c @@ -3026,6 +3026,7 @@ int pv_get_expires(sip_msg_t *msg, pv_param_t *param, pv_value_t *res) unsigned int exp_max = 0; hdr_field_t* hdr; contact_t* c; + contact_t* c0; unsigned int eval = 0; unsigned int ehdr = 0; unsigned int efound = 0; @@ -3056,7 +3057,7 @@ int pv_get_expires(sip_msg_t *msg, pv_param_t *param, pv_value_t *res) } c = ((contact_body_t*)hdr->parsed)->contacts; while(c) { - c = c->next; + c0 = c->next; if(c->expires && c->expires->body.len) { if (str2int(&c->expires->body, &eval) < 0) { LM_ERR("failed to parse expires\n"); @@ -3071,6 +3072,7 @@ int pv_get_expires(sip_msg_t *msg, pv_param_t *param, pv_value_t *res) if(eval>exp_max) exp_max = eval; if(eval<exp_min) exp_min = eval; } + c = c0; } } hdr = hdr->next;