[Asterisk-code-review] res rtp multicast: Fix SEGV in ast multicast rtp create opt... (asterisk[13])

George Joseph asteriskteam at digium.com
Wed Aug 24 14:53:38 CDT 2016


George Joseph has uploaded a new change for review.

  https://gerrit.asterisk.org/3695

Change subject: res_rtp_multicast:  Fix SEGV in ast_multicast_rtp_create_options
......................................................................

res_rtp_multicast:  Fix SEGV in ast_multicast_rtp_create_options

ast_multicast_rtp_create_options now checks for NULL or empty options

Change-Id: Ib845eae46a67a9787e89a87ebd1027344e5e0362
---
M res/res_rtp_multicast.c
1 file changed, 4 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/95/3695/1

diff --git a/res/res_rtp_multicast.c b/res/res_rtp_multicast.c
index 53bdf14..ea31347 100644
--- a/res/res_rtp_multicast.c
+++ b/res/res_rtp_multicast.c
@@ -143,7 +143,7 @@
 
 	mcast_options = ast_calloc(1, sizeof(*mcast_options)
 			+ strlen(type)
-			+ strlen(options) + 2);
+			+ strlen(S_OR(options, "")) + 2);
 	if (!mcast_options) {
 		return NULL;
 	}
@@ -155,8 +155,9 @@
 	mcast_options->type = pos;
 	pos += strlen(type) + 1;
 
-	/* Safe */
-	strcpy(pos, options);
+	if (!ast_strlen_zero(options)) {
+		strcpy(pos, options); /* Safe */
+	}
 	mcast_options->options = pos;
 
 	if (ast_app_parse_options(multicast_rtp_options, &mcast_options->opts,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib845eae46a67a9787e89a87ebd1027344e5e0362
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: George Joseph <gjoseph at digium.com>



More information about the asterisk-code-review mailing list