diff options
author | George Joseph <gjoseph@digium.com> | 2016-08-24 13:42:34 -0600 |
---|---|---|
committer | George Joseph <gjoseph@digium.com> | 2016-08-24 14:53:38 -0500 |
commit | c9e83f6d0be9d89a3beaa509b46c423d78fac6d1 (patch) | |
tree | 58f1cbb48e92cfc09920aaf926c91e6529dcb359 /res | |
parent | b8b5d52b5e1f81a6116fb23e75cbe5a9d3b94673 (diff) |
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
Diffstat (limited to 'res')
-rw-r--r-- | res/res_rtp_multicast.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/res/res_rtp_multicast.c b/res/res_rtp_multicast.c index 53bdf14a4..ea313476e 100644 --- a/res/res_rtp_multicast.c +++ b/res/res_rtp_multicast.c @@ -143,7 +143,7 @@ struct ast_multicast_rtp_options *ast_multicast_rtp_create_options(const char *t 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 @@ struct ast_multicast_rtp_options *ast_multicast_rtp_create_options(const char *t 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, |