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

device: Check return value of snprintf() in win2k_open()

This silences a complaint from the MSVC code analyzer.
parent 665cacf4
......@@ -489,7 +489,10 @@ static int libc_open ( dvdcss_t dvdcss, char const *psz_device )
static int win2k_open ( dvdcss_t dvdcss, char const *psz_device )
{
char psz_dvd[7];
snprintf( psz_dvd, 7, "\\\\.\\%c:", psz_device[0] );
if( snprintf( psz_dvd, sizeof(psz_dvd), "\\\\.\\%c:", psz_device[0] ) < 0)
{
goto error;
}
/* To work around an M$ bug in IOCTL_DVD_READ_STRUCTURE, we need read
* _and_ write access to the device (so we can make SCSI Pass Through
......@@ -513,13 +516,16 @@ static int win2k_open ( dvdcss_t dvdcss, char const *psz_device )
if( (HANDLE) dvdcss->i_fd == INVALID_HANDLE_VALUE )
{
print_error( dvdcss, "failed opening device" );
return -1;
goto error;
}
dvdcss->i_pos = 0;
return 0;
error:
print_error( dvdcss, "failed opening device" );
return -1;
}
static int aspi_open( dvdcss_t dvdcss, char const * psz_device )
......
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