Mercurial > mplayer.hg
comparison libdvdcss/libdvdcss.c @ 31100:45159a4b8815
libdvdcss: Fix potential format string crash; check RPC status on disc access.
This merges upstream revisions 223 and 224 + 225.
author | diego |
---|---|
date | Tue, 11 May 2010 11:10:28 +0000 |
parents | f43e87f69590 |
children | b470391059f3 |
comparison
equal
deleted
inserted
replaced
31099:f43e87f69590 | 31100:45159a4b8815 |
---|---|
365 dvdcss->b_ioctls = _dvdcss_use_ioctls( dvdcss ); | 365 dvdcss->b_ioctls = _dvdcss_use_ioctls( dvdcss ); |
366 | 366 |
367 if( dvdcss->b_ioctls ) | 367 if( dvdcss->b_ioctls ) |
368 { | 368 { |
369 i_ret = _dvdcss_test( dvdcss ); | 369 i_ret = _dvdcss_test( dvdcss ); |
370 if( i_ret < 0 ) | 370 if( i_ret == -2 ) |
371 { | |
372 /* Scrambled disk, RPC-II drive, no region set: bail out */ | |
373 free( dvdcss->psz_device ); | |
374 free( dvdcss ); | |
375 return NULL; | |
376 } | |
377 else if( i_ret < 0 ) | |
371 { | 378 { |
372 /* Disable the CSS ioctls and hope that it works? */ | 379 /* Disable the CSS ioctls and hope that it works? */ |
373 print_debug( dvdcss, | 380 print_debug( dvdcss, |
374 "could not check whether the disc was scrambled" ); | 381 "could not check whether the disc was scrambled" ); |
375 dvdcss->b_ioctls = 0; | 382 dvdcss->b_ioctls = 0; |
418 | 425 |
419 /* If the cache is enabled, extract a unique disc ID */ | 426 /* If the cache is enabled, extract a unique disc ID */ |
420 if( psz_cache ) | 427 if( psz_cache ) |
421 { | 428 { |
422 uint8_t p_sector[DVDCSS_BLOCK_SIZE]; | 429 uint8_t p_sector[DVDCSS_BLOCK_SIZE]; |
423 char psz_debug[PATH_MAX + 30]; | |
424 char psz_key[1 + KEY_SIZE * 2 + 1]; | 430 char psz_key[1 + KEY_SIZE * 2 + 1]; |
425 char *psz_title; | 431 char *psz_title; |
426 uint8_t *psz_serial; | 432 uint8_t *psz_serial; |
427 int i; | 433 int i; |
428 | 434 |
546 i += sprintf( dvdcss->psz_cachefile + i, "/"); | 552 i += sprintf( dvdcss->psz_cachefile + i, "/"); |
547 | 553 |
548 /* Pointer to the filename we will use. */ | 554 /* Pointer to the filename we will use. */ |
549 dvdcss->psz_block = dvdcss->psz_cachefile + i; | 555 dvdcss->psz_block = dvdcss->psz_cachefile + i; |
550 | 556 |
551 sprintf( psz_debug, "using CSS key cache dir: %s", | 557 print_debug( dvdcss, "using CSS key cache dir: %s", |
552 dvdcss->psz_cachefile ); | 558 dvdcss->psz_cachefile ); |
553 print_debug( dvdcss, psz_debug ); | |
554 } | 559 } |
555 nocache: | 560 nocache: |
556 | 561 |
557 #if !defined(WIN32) && !defined(SYS_OS2) | 562 #if !defined(WIN32) && !defined(SYS_OS2) |
558 if( psz_raw_device != NULL ) | 563 if( psz_raw_device != NULL ) |