[libdvdnav-devel] [PATCH] libdvdread: src/ifo_read.c Fix off-by-one error on displaying IFO filename

Jean-Baptiste Kempf jb at videolan.org
Thu May 8 09:44:01 CEST 2014


Applied.

On 07 May, Steve Dibb wrote :
> Fixes incorrect warning:
> 
> libdvdread: Invalid IFO for title 2 (VTS_02_0.BU).
> 
> to:
> 
> libdvdread: Invalid IFO for title 2 (VTS_02_0.BUP).
> 
> diff --git a/src/ifo_read.c b/src/ifo_read.c
> index cc6edd7..5a67dee 100644
> --- a/src/ifo_read.c
> +++ b/src/ifo_read.c
> @@ -305,11 +305,9 @@ ifo_handle_t *ifoOpen(dvd_reader_t *dvd, int title) {
>    }
> 
>    if (title)
> -    snprintf(ifo_filename, 12, "VTS_%02d_0.%s", title, bup_file_opened ?
> "BUP" : "IFO");
> +    snprintf(ifo_filename, 13, "VTS_%02d_0.%s", title, bup_file_opened ?
> "BUP" : "IFO");
>    else
> -    snprintf(ifo_filename, 12, "VIDEO_TS.%s", bup_file_opened ? "BUP" :
> "IFO");
> -
> -  ifo_filename[12] = '\0';
> +    snprintf(ifo_filename, 13, "VIDEO_TS.%s", bup_file_opened ? "BUP" :
> "IFO");
> 
>    if(!ifofile->file) {
>      fprintf(stderr, "libdvdread: Can't open file %s.\n", ifo_filename);
> @@ -369,9 +367,9 @@ ifoOpen_try_bup:
>    ifofile->file = DVDOpenFile(dvd, title, DVD_READ_INFO_BACKUP_FILE);
> 
>    if (title)
> -    snprintf(ifo_filename, 12, "VTS_%02d_0.BUP", title);
> +    snprintf(ifo_filename, 13, "VTS_%02d_0.BUP", title);
>    else
> -    strncpy(ifo_filename, "VIDEO_TS.BUP", 12);
> +    strncpy(ifo_filename, "VIDEO_TS.BUP", 13);
> 
>    if (!ifofile->file) {
>      fprintf(stderr, "libdvdread: Can't open file %s.\n", ifo_filename);
> _______________________________________________
> 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


More information about the libdvdnav-devel mailing list