]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_rtp_multicast: Fix SEGV in ast_multicast_rtp_create_options 95/3695/1
authorGeorge Joseph <gjoseph@digium.com>
Wed, 24 Aug 2016 19:42:34 +0000 (13:42 -0600)
committerGeorge Joseph <gjoseph@digium.com>
Wed, 24 Aug 2016 19:53:38 +0000 (14:53 -0500)
ast_multicast_rtp_create_options now checks for NULL or empty options

Change-Id: Ib845eae46a67a9787e89a87ebd1027344e5e0362

res/res_rtp_multicast.c

index 53bdf14a4cdaea6b1e50b8bed942b39b90ff36da..ea313476e6443f105cbaa615c20c2ccff26d1b91 100644 (file)
@@ -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,