summaryrefslogtreecommitdiff
path: root/pjsip
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2008-04-07 10:10:31 +0000
committerBenny Prijono <bennylp@teluu.com>2008-04-07 10:10:31 +0000
commit4521b44c664bb00a04d628e2e3cf1d0f21293301 (patch)
treede87ede4b6102876d19a8c820fe9a6d962e28401 /pjsip
parent43990d32dc2d14e946c2b93d0810b33e87424d0a (diff)
Fixed crash in SRTP when incoming SDP is received without any m= line (thanks Atik)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1909 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r--pjsip/src/pjsua-lib/pjsua_call.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_call.c b/pjsip/src/pjsua-lib/pjsua_call.c
index 4035011a..58330988 100644
--- a/pjsip/src/pjsua-lib/pjsua_call.c
+++ b/pjsip/src/pjsua-lib/pjsua_call.c
@@ -716,13 +716,27 @@ pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata)
rdata->msg_info.msg->body->data,
rdata->msg_info.msg->body->len, &offer);
if (status != PJ_SUCCESS) {
- pjsua_perror(THIS_FILE, "Error parsing SDP in incoming INVITE", status);
- pjsip_endpt_respond_stateless(pjsua_var.endpt, rdata, 400, NULL,
+ const pj_str_t reason = pj_str("Bad SDP");
+ pjsua_perror(THIS_FILE, "Error parsing SDP in incoming INVITE",
+ status);
+ pjsip_endpt_respond_stateless(pjsua_var.endpt, rdata, 400, &reason,
NULL, NULL);
pjsua_media_channel_deinit(call->index);
PJSUA_UNLOCK();
return PJ_TRUE;
}
+
+ /* Do quick checks on SDP before passing it to transports. More elabore
+ * checks will be done in pjsip_inv_verify_request2() below.
+ */
+ if (offer->media_count==0) {
+ const pj_str_t reason = pj_str("Missing media in SDP");
+ pjsip_endpt_respond(pjsua_var.endpt, NULL, rdata, 400, &reason,
+ NULL, NULL, NULL);
+ PJSUA_UNLOCK();
+ return PJ_TRUE;
+ }
+
} else {
offer = NULL;
}