mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
Merge "res_pjsip/res_pjsip_callerid: NULL check on caller id name string" into 13
This commit is contained in:
@@ -4380,11 +4380,15 @@ void ast_sip_modify_id_header(pj_pool_t *pool, pjsip_fromto_hdr *id_hdr, const s
|
||||
id_uri = pjsip_uri_get_uri(id_name_addr->uri);
|
||||
|
||||
if (id->name.valid) {
|
||||
int name_buf_len = strlen(id->name.str) * 2 + 1;
|
||||
char *name_buf = ast_alloca(name_buf_len);
|
||||
if (!ast_strlen_zero(id->name.str)) {
|
||||
int name_buf_len = strlen(id->name.str) * 2 + 1;
|
||||
char *name_buf = ast_alloca(name_buf_len);
|
||||
|
||||
ast_escape_quoted(id->name.str, name_buf, name_buf_len);
|
||||
pj_strdup2(pool, &id_name_addr->display, name_buf);
|
||||
ast_escape_quoted(id->name.str, name_buf, name_buf_len);
|
||||
pj_strdup2(pool, &id_name_addr->display, name_buf);
|
||||
} else {
|
||||
pj_strdup2(pool, &id_name_addr->display, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (id->number.valid) {
|
||||
|
@@ -436,7 +436,7 @@ static pjsip_fromto_hdr *create_new_id_hdr(const pj_str_t *hdr_name, pjsip_fromt
|
||||
id_name_addr = pjsip_uri_clone(tdata->pool, base->uri);
|
||||
id_uri = pjsip_uri_get_uri(id_name_addr->uri);
|
||||
|
||||
if (id->name.valid) {
|
||||
if (id->name.valid && !ast_strlen_zero(id->name.str)) {
|
||||
int name_buf_len = strlen(id->name.str) * 2 + 1;
|
||||
char *name_buf = ast_alloca(name_buf_len);
|
||||
|
||||
@@ -450,7 +450,12 @@ static pjsip_fromto_hdr *create_new_id_hdr(const pj_str_t *hdr_name, pjsip_fromt
|
||||
pj_strdup2(tdata->pool, &id_name_addr->display, NULL);
|
||||
}
|
||||
|
||||
pj_strdup2(tdata->pool, &id_uri->user, id->number.str);
|
||||
if (id->number.valid) {
|
||||
pj_strdup2(tdata->pool, &id_uri->user, id->number.str);
|
||||
} else {
|
||||
/* Similar to name, make sure the number is also cleared when invalid */
|
||||
pj_strdup2(tdata->pool, &id_uri->user, NULL);
|
||||
}
|
||||
|
||||
id_hdr->uri = (pjsip_uri *) id_name_addr;
|
||||
return id_hdr;
|
||||
|
Reference in New Issue
Block a user