mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 19:28:53 +00:00
pjsip_messaging, pjsip_header_funcs: Crashes due to NULL pointer dereferences
Both res_pjsip_messaging and res_pjsip_header_funcs were causing asterisk to crash because they were trying to dereference a NULL pointer. In the case of res_pjsip_messaging it was attempting to "print" a contact header that did not exist. In fact contact headers should not be part of a SIP MESSAGE, so the offending code was simply removed. In the case of res_pjsip_header_funcs a null private channel tech was being passed to the function and then later dereferenced. Added null checks (and error logging) to the read/write function handlers to guard against crashing. (closes issue ASTERISK-22821) Reported by: Anthony Messina ........ Merged revisions 402757 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@402758 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -452,6 +452,11 @@ static int func_read_header(struct ast_channel *chan, const char *function, char
|
||||
AST_APP_ARG(header_name); AST_APP_ARG(header_number););
|
||||
AST_STANDARD_APP_ARGS(args, data);
|
||||
|
||||
if (!channel) {
|
||||
ast_log(LOG_ERROR, "This function requires a PJSIP channel.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ast_strlen_zero(args.action)) {
|
||||
ast_log(AST_LOG_ERROR, "This function requires an action.\n");
|
||||
return -1;
|
||||
@@ -506,6 +511,11 @@ static int func_write_header(struct ast_channel *chan, const char *cmd, char *da
|
||||
AST_APP_ARG(header_name); AST_APP_ARG(header_number););
|
||||
AST_STANDARD_APP_ARGS(args, data);
|
||||
|
||||
if (!channel) {
|
||||
ast_log(LOG_ERROR, "This function requires a PJSIP channel.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ast_strlen_zero(args.action)) {
|
||||
ast_log(AST_LOG_ERROR, "This function requires an action.\n");
|
||||
return -1;
|
||||
|
Reference in New Issue
Block a user