Browse code

topoh: more safety checks for bad cseq (cherry picked from commit 7f9b429075fa870b6bfdc4fc1a08c396f6c8eeb5) (cherry picked from commit eb969ad69d341a851e9ee89c73c5006237329f04)

Daniel-Constantin Mierla authored on 04/02/2011 17:26:37
Showing 2 changed files
... ...
@@ -1033,7 +1033,7 @@ int th_route_direction(sip_msg_t *msg)
1033 1033
 
1034 1034
 int th_skip_msg(sip_msg_t *msg)
1035 1035
 {
1036
-	if (!get_cseq(msg)) {
1036
+	if (msg->cseq==NULL || get_cseq(msg)==NULL) {
1037 1037
 		LM_WARN("Invalid/Unparsed CSeq in message. Skipping.");
1038 1038
 		return 1;
1039 1039
 	}
... ...
@@ -178,7 +178,10 @@ int th_msg_received(void *data)
178 178
 	msg.buf = obuf->s;
179 179
 	msg.len = obuf->len;
180 180
 
181
-	th_prepare_msg(&msg);
181
+	if(th_prepare_msg(&msg)!=0)
182
+	{
183
+		goto done;
184
+	}
182 185
 
183 186
 	if(th_skip_msg(&msg))
184 187
 	{
... ...
@@ -260,7 +263,10 @@ int th_msg_sent(void *data)
260 263
 	msg.buf = obuf->s;
261 264
 	msg.len = obuf->len;
262 265
 
263
-	th_prepare_msg(&msg);
266
+	if(th_prepare_msg(&msg)!=0)
267
+	{
268
+		goto done;
269
+	}
264 270
 
265 271
 	if(th_skip_msg(&msg))
266 272
 	{