diff options
author | 2010-05-11 11:10:28 +0000 | |
---|---|---|
committer | 2010-05-11 11:10:28 +0000 | |
commit | 6f3e65b6f53547a0f19f89728c7113f6de724b35 (patch) | |
tree | d0ba2a3571c167ed5062d99fb6c07492154eb55a /libdvdcss/libdvdcss.c | |
parent | ec814ff6378e08dd426c0413f14345c449d30bcb (diff) |
libdvdcss: Fix potential format string crash; check RPC status on disc access.
This merges upstream revisions 223 and 224 + 225.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31157 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libdvdcss/libdvdcss.c')
-rw-r--r-- | libdvdcss/libdvdcss.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/libdvdcss/libdvdcss.c b/libdvdcss/libdvdcss.c index d189faddf2..f39d7025d4 100644 --- a/libdvdcss/libdvdcss.c +++ b/libdvdcss/libdvdcss.c @@ -367,7 +367,14 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target ) if( dvdcss->b_ioctls ) { i_ret = _dvdcss_test( dvdcss ); - if( i_ret < 0 ) + if( i_ret == -2 ) + { + /* Scrambled disk, RPC-II drive, no region set: bail out */ + free( dvdcss->psz_device ); + free( dvdcss ); + return NULL; + } + else if( i_ret < 0 ) { /* Disable the CSS ioctls and hope that it works? */ print_debug( dvdcss, @@ -420,7 +427,6 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target ) if( psz_cache ) { uint8_t p_sector[DVDCSS_BLOCK_SIZE]; - char psz_debug[PATH_MAX + 30]; char psz_key[1 + KEY_SIZE * 2 + 1]; char *psz_title; uint8_t *psz_serial; @@ -548,9 +554,8 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target ) /* Pointer to the filename we will use. */ dvdcss->psz_block = dvdcss->psz_cachefile + i; - sprintf( psz_debug, "using CSS key cache dir: %s", - dvdcss->psz_cachefile ); - print_debug( dvdcss, psz_debug ); + print_debug( dvdcss, "using CSS key cache dir: %s", + dvdcss->psz_cachefile ); } nocache: |