[Asterisk-code-review] Chaos: handle failed allocation in get media encryption type (asterisk[13])

Mark Michelson asteriskteam at digium.com
Thu Aug 27 14:52:58 CDT 2015


Mark Michelson has submitted this change and it was merged.

Change subject: Chaos: handle failed allocation in get_media_encryption_type
......................................................................


Chaos: handle failed allocation in get_media_encryption_type

If the ast_strndup() call fails to allocate a copy of the
transport string for parsing, fail gracefully.

ASTERISK-25323
Reported by: Scott Griepentrog

Change-Id: Ia4b905ce6d03da53fea526224455c1044b1a5a28
---
M res/res_pjsip_sdp_rtp.c
1 file changed, 3 insertions(+), 0 deletions(-)

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



diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c
index 0a5cbcb..208d348 100644
--- a/res/res_pjsip_sdp_rtp.c
+++ b/res/res_pjsip_sdp_rtp.c
@@ -602,6 +602,9 @@
 
 	*optimistic = 0;
 
+	if (!transport_str) {
+		return AST_SIP_MEDIA_TRANSPORT_INVALID;
+	}
 	if (strstr(transport_str, "UDP/TLS")) {
 		return AST_SIP_MEDIA_ENCRYPT_DTLS;
 	} else if (strstr(transport_str, "SAVP")) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia4b905ce6d03da53fea526224455c1044b1a5a28
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Scott Griepentrog <sgriepentrog at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-code-review mailing list