Browse code

rtpengine: get again body pointer only when read_sdp_pv is set

- reported by GH #1434

Daniel-Constantin Mierla authored on 08/02/2018 18:13:08
Showing 1 changed files
... ...
@@ -3351,12 +3351,17 @@ rtpengine_offer_answer(struct sip_msg *msg, const char *flags, int op, int more)
3351 3351
 			pkg_free(newbody.s);
3352 3352
 
3353 3353
 		} else {
3354
-			/* get the body from the message as body ptr may have changed */
3355
-			cur_body.len = 0;
3356
-			cur_body.s = get_body(msg);
3357
-			cur_body.len = msg->buf + msg->len - cur_body.s;
3358
-
3359
-			anchor = del_lump(msg, cur_body.s - msg->buf, cur_body.len, 0);
3354
+			if (read_sdp_pvar_str.len > 0) {
3355
+				/* get the body from the message as body ptr may have changed
3356
+				 * when using read_sdp_pv */
3357
+				cur_body.len = 0;
3358
+				cur_body.s = get_body(msg);
3359
+				cur_body.len = msg->buf + msg->len - cur_body.s;
3360
+
3361
+				anchor = del_lump(msg, cur_body.s - msg->buf, cur_body.len, 0);
3362
+			} else {
3363
+				anchor = del_lump(msg, body.s - msg->buf, body.len, 0);
3364
+			}
3360 3365
 			if (!anchor) {
3361 3366
 				LM_ERR("del_lump failed\n");
3362 3367
 				goto error_free;