[libdvdcss-devel] [PATCH RFC] libdvdcss: fix cache subdir creation
Manuel Lauss
manuel.lauss at gmail.com
Tue Feb 17 13:46:21 CET 2015
Hi,
With mplayer and libdvdcss-1.3.99 I've been seeing that libdvdcss can't create
a cache dir for all discs:
libdvdcss error: PRE psz_cachefile: [/home/mano/.dvdcss]
libdvdcss error: failed creating cache subdirectory
[/XFILES_D1-2001022114425500-
0ff6f6f8cd][-1]
It looks like sprintf() first clears the target buffer (psz_cachefile)
and then appends the strings
in order they're listed, leading to the above inability to create a
cache subdir at the root of the fs.
The hackish patch below fixes that.
Thanks,
Manuel Lauss
--- src/libdvdcss.c.orig 2015-02-17 13:29:26.480730014 +0100
+++ src/libdvdcss.c 2015-02-17 13:30:04.541769413 +0100
@@ -308,7 +308,7 @@ static int init_cache_dir( dvdcss_t dvdc
static void create_cache_subdir( dvdcss_t dvdcss )
{
uint8_t p_sector[DVDCSS_BLOCK_SIZE];
- char psz_key[STRING_KEY_SIZE + 1];
+ char psz_key[STRING_KEY_SIZE + 1], psz_tmp[PATH_MAX];
char *psz_title;
uint8_t *psz_serial;
int i, i_ret;
@@ -403,8 +403,9 @@ static void create_cache_subdir( dvdcss_
}
/* We have a disc name or ID, we can create the cache subdirectory. */
+ strcpy(psz_tmp, dvdcss->psz_cachefile);
i = sprintf( dvdcss->psz_cachefile, "%s/%s-%s-%s",
- dvdcss->psz_cachefile, psz_title, psz_serial, psz_key );
+ psz_tmp, psz_title, psz_serial, psz_key );
i_ret = mkdir( dvdcss->psz_cachefile, 0755 );
if( i_ret < 0 && errno != EEXIST )
{
More information about the libdvdcss-devel
mailing list