[asterisk-commits] CHAOS: res pjsip diversion avoid crash if allocation fails (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Sep 19 09:15:22 CDT 2015


Matt Jordan has submitted this change and it was merged.

Change subject: CHAOS: res_pjsip_diversion avoid crash if allocation fails
......................................................................


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
---
M res/res_pjsip_diversion.c
1 file changed, 3 insertions(+), 1 deletion(-)

Approvals:
  Anonymous Coward #1000019: Verified
  Matt Jordan: Looks good to me, approved
  Joshua Colp: Looks good to me, but someone else must approve



diff --git a/res/res_pjsip_diversion.c b/res/res_pjsip_diversion.c
index 3dfae45..ea2c7cd 100644
--- a/res/res_pjsip_diversion.c
+++ b/res/res_pjsip_diversion.c
@@ -117,7 +117,9 @@
 {
 	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,

-- 
To view, visit https://gerrit.asterisk.org/1283
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I15d2ed7cb0546818264c0bf251aa40adeae83253
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-commits mailing list