[vlc-commits] addons: fsstorage: handle Win32 paths
Francois Cartegnie
git at videolan.org
Tue Feb 11 13:12:29 CET 2014
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Feb 11 13:07:56 2014 +0100| [591ec61dc12f747b1e840f0f779fb41ee0ceb32f] | committer: Francois Cartegnie
addons: fsstorage: handle Win32 paths
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=591ec61dc12f747b1e840f0f779fb41ee0ceb32f
---
modules/misc/addons/fsstorage.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/modules/misc/addons/fsstorage.c b/modules/misc/addons/fsstorage.c
index 6b9a06c..e0f51e2 100644
--- a/modules/misc/addons/fsstorage.c
+++ b/modules/misc/addons/fsstorage.c
@@ -435,13 +435,21 @@ static int InstallAllFiles( addons_storage_t *p_this, const addon_entry_t *p_ent
if ( strstr( p_file->psz_filename, ".." ) )
return VLC_EGENERIC;
+ char *psz_translated_filename = strdup( p_file->psz_filename );
+ if ( !psz_translated_filename )
+ return VLC_ENOMEM;
+ char *tmp = psz_translated_filename;
+ while (*tmp++) if ( *tmp == '/' ) *tmp = DIR_SEP_CHAR;
+
char *psz_dir = getAddonInstallDir( p_file->e_filetype );
if ( !psz_dir || asprintf( &psz_dest, "%s"DIR_SEP"%s", psz_dir,
- p_file->psz_filename ) < 1 )
+ psz_translated_filename ) < 1 )
{
free( psz_dir );
+ free( psz_translated_filename );
return VLC_EGENERIC;
}
+ free( psz_translated_filename );
free( psz_dir );
if ( InstallFile( p_this, p_file->psz_download_uri, psz_dest ) != VLC_SUCCESS )
@@ -803,14 +811,23 @@ static int Remove( addons_storage_t *p_storage, addon_entry_t *p_entry )
case ADDON_SKIN2:
{
char *psz_dest;
+
+ char *psz_translated_filename = strdup( p_file->psz_filename );
+ if ( !psz_translated_filename )
+ return VLC_ENOMEM;
+ char *tmp = psz_translated_filename;
+ while (*tmp++) if ( *tmp == '/' ) *tmp = DIR_SEP_CHAR;
+
char *psz_dir = getAddonInstallDir( p_file->e_filetype );
if ( !psz_dir || asprintf( &psz_dest, "%s"DIR_SEP"%s", psz_dir,
- p_file->psz_filename ) < 1 )
+ psz_translated_filename ) < 1 )
{
free( psz_dir );
+ free( psz_translated_filename );
return VLC_EGENERIC;
}
free( psz_dir );
+ free( psz_translated_filename );
vlc_unlink( psz_dest );
msg_Dbg( p_storage, "removing %s", psz_dest );
More information about the vlc-commits
mailing list