Commit 28713727 authored by Diego Biurrun's avatar Diego Biurrun
Browse files

libdvdcss: Skip NULL checks at the end of set_cache_directory().

The code guarantees that values have been assigned at this point.
parent 2aca6d8b
......@@ -260,22 +260,14 @@ static char *set_cache_directory( dvdcss_t dvdcss )
#endif /* ! defined(_WIN32_IE) && _WIN32_IE >= 0x500 */
}
/* Sanity check psz_cache value. */
if( psz_cache != NULL )
/* Check that there is enough space for the cache directory path and the
* block filename. The +1 are path separators and terminating null byte. */
if( strlen( psz_cache ) + 1 + DISC_TITLE_LENGTH + 1 +
MANUFACTURING_DATE_LENGTH + 1 + STRING_KEY_SIZE + 1 +
CACHE_FILENAME_LENGTH + 1 > PATH_MAX )
{
if( psz_cache[0] == '\0' )
{
return NULL;
}
/* Check that there is enough space for the cache directory path and the
* block filename. The +1 are path separators and terminating null byte. */
else if( strlen( psz_cache ) + 1 + DISC_TITLE_LENGTH + 1 +
MANUFACTURING_DATE_LENGTH + 1 + STRING_KEY_SIZE + 1 +
CACHE_FILENAME_LENGTH + 1 > PATH_MAX )
{
print_error( dvdcss, "cache directory name is too long" );
return NULL;
}
print_error( dvdcss, "cache directory name is too long" );
return NULL;
}
return psz_cache;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment