From 4521b44c664bb00a04d628e2e3cf1d0f21293301 Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Mon, 7 Apr 2008 10:10:31 +0000 Subject: 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 --- pjsip/src/pjsua-lib/pjsua_call.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'pjsip') 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; } -- cgit v1.2.3