CHAOS: res_pjsip_diversion avoid crash if allocation fails

Validate ast_malloc buffer returned before using it in
set_redirecting_value().

ASTERISK-25323

Change-Id: I15d2ed7cb0546818264c0bf251aa40adeae83253
This commit is contained in:
Richard Mudgett
2015-09-17 16:59:18 -05:00
parent a665b31281
commit 4cc59533b9

View File

@@ -117,7 +117,9 @@ static void set_redirecting_value(char **dst, const pj_str_t *src)
{
ast_free(*dst);
*dst = ast_malloc(pj_strlen(src) + 1);
ast_copy_pj_str(*dst, src, pj_strlen(src) + 1);
if (*dst) {
ast_copy_pj_str(*dst, src, pj_strlen(src) + 1);
}
}
static void set_redirecting_id(pjsip_name_addr *name_addr, struct ast_party_id *data,