Module: kamailio Branch: master Commit: 3fe7fd27605ed9f506a95d11d4c88b78f22eadd1 URL: https://github.com/kamailio/kamailio/commit/3fe7fd27605ed9f506a95d11d4c88b78...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2015-11-27T14:37:03+01:00
pv: fix for $expires() variables
- invalid while iterator was used, resulting in crash - reported by Jayesh Nambiar
---
Modified: modules/pv/pv_core.c
---
Diff: https://github.com/kamailio/kamailio/commit/3fe7fd27605ed9f506a95d11d4c88b78... Patch: https://github.com/kamailio/kamailio/commit/3fe7fd27605ed9f506a95d11d4c88b78...
---
diff --git a/modules/pv/pv_core.c b/modules/pv/pv_core.c index 9ce9da2..71e6ab3 100644 --- a/modules/pv/pv_core.c +++ b/modules/pv/pv_core.c @@ -3038,6 +3038,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; @@ -3068,7 +3069,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"); @@ -3083,6 +3084,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;