[libdvdnav-devel] [PATCH] src/dvd_reader.c: Fix a potential NULL dereference

John Stebbins jstebbins at jetheaddev.com
Fri Oct 24 04:42:42 CEST 2014


If my memory isn't playing tricks on me, I recall getting a crash printing null on android.


On October 23, 2014 7:06:16 PM PDT, Jean-Baptiste Kempf <jb at videolan.org> wrote:
>Hello,
>
>On what platform does this crash?
>
>Because printf of NULL usually displays (null) on most platfomrs.
>
>On 24 Oct, Andrew Clayton wrote :
>> In DVDOpen() one of the first things that is done is
>> 
>>     path = strdup(ppath);
>> 
>> path is then checked for NULL, if it is we jump to DVDOpen_error;
>where
>> the first thing done is to print en error message using path. This
>bit
>> of code is used as a general fall back so we don't want to stop
>> displaying path in the cases where it isn't NULL.
>> 
>> The simplest solution is to simply put a guard on it in the fprintf
>> statement, in the case that path is NULL use "" instead of path.
>> 
>> Signed-off-by: Andrew Clayton <andrew at digital-domain.net>
>> ---
>>  src/dvd_reader.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/src/dvd_reader.c b/src/dvd_reader.c
>> index fb045b3..80b567d 100644
>> --- a/src/dvd_reader.c
>> +++ b/src/dvd_reader.c
>> @@ -603,7 +603,7 @@ dvd_reader_t *DVDOpen( const char *ppath )
>>  
>>  DVDOpen_error:
>>    /* If it's none of the above, screw it. */
>> -  fprintf( stderr, "libdvdread: Could not open %s\n", path );
>> +  fprintf( stderr, "libdvdread: Could not open %s\n", (path) ? path
>: "");
>>    free( path );
>>    free( path_copy );
>>    if ( cdir >= 0 )
>> -- 
>> 1.9.3
>> 
>> _______________________________________________
>> libdvdnav-devel mailing list
>> libdvdnav-devel at videolan.org
>> https://mailman.videolan.org/listinfo/libdvdnav-devel
>
>-- 
>With my kindest regards,
>
>-- 
>Jean-Baptiste Kempf
>http://www.jbkempf.com/ - +33 672 704 734
>Sent from my Electronic Device
>_______________________________________________
>libdvdnav-devel mailing list
>libdvdnav-devel at videolan.org
>https://mailman.videolan.org/listinfo/libdvdnav-devel

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/libdvdnav-devel/attachments/20141023/af8fe438/attachment.html>


More information about the libdvdnav-devel mailing list