Skip to content

Commit 864bb28

Browse files
authored
Prevent crash when pjsip_inv_verify_request3() return error (#4503)
1 parent 11373d2 commit 864bb28

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

pjsip/src/pjsua-lib/pjsua_call.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1410,6 +1410,7 @@ static pj_status_t verify_request(const pjsua_call *call,
14101410

14111411
if (status == PJ_SUCCESS) {
14121412
unsigned options = 0;
1413+
pjsip_tx_data *tx_data_resp = NULL;
14131414

14141415
/* Add SIPREC support to prevent the "bad extension" error */
14151416
options |= PJSIP_INV_SUPPORT_SIPREC;
@@ -1418,17 +1419,20 @@ static pj_status_t verify_request(const pjsua_call *call,
14181419
status = pjsip_inv_verify_request3(rdata,
14191420
call->inv->pool_prov, &options,
14201421
offer, answer, NULL,
1421-
pjsua_var.endpt, response);
1422+
pjsua_var.endpt, &tx_data_resp);
14221423
if (status != PJ_SUCCESS) {
14231424
/*
14241425
* No we can't handle the incoming INVITE request.
14251426
*/
14261427
pjsua_perror(THIS_FILE, "Request verification failed", status);
14271428

1428-
if (response)
1429-
err_code = (*response)->msg->line.status.code;
1429+
if (tx_data_resp)
1430+
err_code = tx_data_resp->msg->line.status.code;
14301431
else
1431-
err_code = PJSIP_SC_NOT_ACCEPTABLE_HERE;
1432+
err_code = PJSIP_SC_NOT_ACCEPTABLE_HERE;
1433+
1434+
if (response)
1435+
*response = tx_data_resp;
14321436
}
14331437
}
14341438

0 commit comments

Comments
 (0)