Added
Link Here
|
0 |
- |
1 |
--- src/libdvdcss.c.orig 2018-03-02 15:44:29 UTC |
|
|
2 |
+++ src/libdvdcss.c |
3 |
@@ -320,7 +320,19 @@ static int init_cache_dir( dvdcss_t dvdcss ) |
4 |
return -1; |
5 |
} |
6 |
|
7 |
- sprintf( psz_tagfile, "%s/" CACHE_TAG_NAME, dvdcss->psz_cachefile ); |
8 |
+ i_ret = snprintf( psz_tagfile, PATH_MAX, "%s/" CACHE_TAG_NAME, |
9 |
+ dvdcss->psz_cachefile ); |
10 |
+ if ( i_ret < 0 || i_ret >= PATH_MAX) |
11 |
+ { |
12 |
+ if ( i_ret < 0) |
13 |
+ print_error( dvdcss, "failed to compose cache directory tag path"); |
14 |
+ else |
15 |
+ print_error( dvdcss, "cache directory tag path too long: %s/" CACHE_TAG_NAME, |
16 |
+ dvdcss->psz_cachefile ); |
17 |
+ dvdcss->psz_cachefile[0] = '\0'; |
18 |
+ return -1; |
19 |
+ } |
20 |
+ |
21 |
i_fd = open( psz_tagfile, O_RDWR|O_CREAT, 0644 ); |
22 |
if( i_fd >= 0 ) |
23 |
{ |