Browse code

- fixed bad to check (crash for messages w/o to header)

Andrei Pelinescu-Onciul authored on 16/11/2006 20:55:54
Showing 1 changed files
... ...
@@ -155,8 +155,10 @@ int get_to_uid(str* uid, struct sip_msg* msg)
155 155
 		*uid = val.s;
156 156
 		return 1;
157 157
 	} else {
158
-		if (parse_headers(msg, HDR_TO_F, 0) < 0) {
159
-			LOG(L_ERR, "get_to_uid: Error while parsing To URI (parse_headers)\n");
158
+		if ((msg->to==0) && 
159
+				(parse_headers(msg, HDR_TO_F, 0)<0 || msg->to==0)) {
160
+			LOG(L_ERR, "get_to_uid: Error while parsing To URI: "
161
+					" to header bad or missing\n");
160 162
 			return -1;
161 163
 		}
162 164
 		to = get_to(msg);