Skip to content
Snippets Groups Projects
Verified Commit d4fa7b67 authored by Yalu Zhang's avatar Yalu Zhang Committed by IOPSYS Dev
Browse files

Fix a segmentation fault caused by DT syslog with NULL pointer access, REF 16138

Add validation check to prevent NULL pointers from being accessed.
parent 05600265
No related branches found
No related tags found
1 merge request!298Fix a segmentation fault caused by DT syslog with NULL pointer access, REF 16138
......@@ -415,13 +415,6 @@ static enum ast_sip_check_auth_result digest_check_auth(struct ast_sip_endpoint
int is_artificial;
int failures = 0;
size_t auth_size;
pjsip_sip_uri *client_uri;
pjsip_contact_hdr *contact_hdr;
contact_hdr = pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT, NULL);
if(contact_hdr){
client_uri = pjsip_uri_get_uri(contact_hdr->uri);
}
auth_size = AST_VECTOR_SIZE(&endpoint->inbound_auths);
ast_assert(0 < auth_size);
......@@ -493,8 +486,17 @@ static enum ast_sip_check_auth_result digest_check_auth(struct ast_sip_endpoint
failures++;
}
if(verify_res[idx] == AUTH_NOAUTH) {
/* lack of auth. IPX003 */
ast_log_dt(LOG_EVENT_CODE_IPX003, (int) client_uri->user.slen, client_uri->user.ptr, (int) client_uri->host.slen, client_uri->host.ptr);
if (rdata && rdata->msg_info.msg) {
pjsip_contact_hdr *contact_hdr = pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT, NULL);
if (contact_hdr && contact_hdr->uri) {
pjsip_sip_uri *client_uri = pjsip_uri_get_uri(contact_hdr->uri);
if (client_uri) {
/* lack of auth. IPX003 */
ast_log_dt(LOG_EVENT_CODE_IPX003, (int)client_uri->user.slen, client_uri->user.ptr,
(int)client_uri->host.slen, client_uri->host.ptr);
}
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment