]> git.sesse.net Git - vlc/commitdiff
* modules/control/http/macro.c: Add slashes in the MVLC_ADD macro for
authorChristophe Massiot <massiot@videolan.org>
Wed, 12 Apr 2006 14:26:21 +0000 (14:26 +0000)
committerChristophe Massiot <massiot@videolan.org>
Wed, 12 Apr 2006 14:26:21 +0000 (14:26 +0000)
   backwards compatibility with the old http intf (anyway MVLC_ADD is
   obsoleted by RPN function playlist_add).

modules/control/http/macro.c

index 7ea5cf193a334f7fffdb2a1ce9812e4247b6e6c4..0b7bc35ce3892890dfc73aeb37e5a10c059fb4a2 100644 (file)
@@ -301,17 +301,32 @@ void E_(MacroDo)( httpd_file_sys_t *p_args,
                 /* playlist management */
                 case MVLC_ADD:
                 {
-                    char mrl[1024], psz_name[1024];
+                    char mrl[1024], psz_name[1024], tmp[1024];
+                    char *p, *str;
                     playlist_item_t *p_item;
 
-                    E_(ExtractURIValue)( p_request, "mrl", mrl, 1024 );
-                    decode_URI( mrl );
+                    E_(ExtractURIValue)( p_request, "mrl", tmp, 1024 );
+                    decode_URI( tmp );
                     E_(ExtractURIValue)( p_request, "name", psz_name, 1024 );
                     decode_URI( psz_name );
                     if( !*psz_name )
                     {
                         memcpy( psz_name, mrl, 1024 );
                     }
+                    /* addslashes for backward compatibility with the old
+                     * http intf */
+                    p = mrl; str = tmp;
+                    while( *str != '\0' )
+                    {
+                        if( *str == '"' || *str == '\'' || *str == '\\' )
+                        {
+                            *p++ = '\\';
+                        }
+                        *p++ = *str;
+                        str++;
+                    }
+                    *p = '\0';
+
                     p_item = E_(MRLParse)( p_intf, mrl, psz_name );
 
                     if( !p_item || !p_item->input.psz_uri ||