فهرست منبع

siptrace: check if To header is parsed and available

- it is accessed and can lead to crash if not prepared
- reported by GH #263
Daniel-Constantin Mierla 10 سال پیش
والد
کامیت
93b297e161
1فایلهای تغییر یافته به همراه5 افزوده شده و 0 حذف شده
  1. 5 0
      modules/siptrace/siptrace.c

+ 5 - 0
modules/siptrace/siptrace.c

@@ -535,6 +535,11 @@ static int sip_trace_prepare(sip_msg_t *msg)
 		goto error;
 	}
 
+	if(parse_to_header(msg)==-1 || msg->to==NULL || get_to(msg)==NULL) {
+		LM_ERR("cannot parse To header\n");
+		goto error;
+	}
+
 	if(parse_headers(msg, HDR_CALLID_F, 0)!=0 || msg->callid==NULL
 			|| msg->callid->body.s==NULL) {
 		LM_ERR("cannot parse call-id\n");