Browse Source

uac: init avp_value lenght to be safe when avp is not found for restoring From/To URI

- reported by Klaus Darilion, FS#479
Daniel-Constantin Mierla 11 năm trước cách đây
mục cha
commit
a4432c3270
1 tập tin đã thay đổi với 4 bổ sung5 xóa
  1. 4 5
      modules/uac/replace.c

+ 4 - 5
modules/uac/replace.c

@@ -671,7 +671,8 @@ static inline int restore_uri_reply(struct sip_msg *rpl,
 	char *p;
 
 	if(stored_value->len) {
-		LM_DBG("stored AVP value is '%.*s'with len '%d'\n",stored_value->len, stored_value->s,stored_value->len);
+		LM_DBG("stored AVP value is '%.*s'with len '%d'\n",
+				stored_value->len, stored_value->s, stored_value->len);
 		len=stored_value->len;
 		p = stored_value->s;
 	} else {
@@ -742,10 +743,9 @@ void restore_uris_reply(struct cell* t, int type, struct tmcb_params *p)
 			return;
 		}
 
+		avp_value.s.len=0;
 		if(restore_from_avp.s) {
 			search_first_avp(restore_from_avp_type, restore_from_avp_name, &avp_value,0);
-		} else {
-			avp_value.s.len=0;
 		}
 
 		if (restore_uri_reply( rpl, rpl->from, req->from, &avp_value.s)) {
@@ -762,10 +762,9 @@ void restore_uris_reply(struct cell* t, int type, struct tmcb_params *p)
 			return;
 		}
 
+		avp_value.s.len=0;
 		if(restore_to_avp.s) {
 			search_first_avp(restore_to_avp_type, restore_to_avp_name, &avp_value,0);
-		} else {
-			avp_value.s.len=0;
 		}
 
 		if (restore_uri_reply( rpl, rpl->to, req->to, &avp_value.s)) {