2
0
Эх сурвалжийг харах

pv: fix for $expires() variables

- invalid while iterator was used, resulting in crash
- reported by Jayesh Nambiar

(cherry picked from commit 3fe7fd27605ed9f506a95d11d4c88b78f22eadd1)
(cherry picked from commit 583dc060e89b87bcba241edcedd8d48413640fc1)
Daniel-Constantin Mierla 10 жил өмнө
parent
commit
2c796e60f7
1 өөрчлөгдсөн 3 нэмэгдсэн , 1 устгасан
  1. 3 1
      modules/pv/pv_core.c

+ 3 - 1
modules/pv/pv_core.c

@@ -3027,6 +3027,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;
@@ -3057,7 +3058,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");
@@ -3072,6 +3073,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;