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

Steve Dibb git at videolan.org
Thu May 8 09:46:20 CEST 2014


libdvdread | branch: master | Steve Dibb <beandog at gentoo.org> | Wed May  7 13:09:15 2014 -0600| [c3f1a56caa4f876ed3753935d95d93292cfd5ed7] | committer: Jean-Baptiste Kempf

libdvdread: src/ifo_read.c Fix off-by-one error on displaying IFO filename

Fixes incorrect warning:

libdvdread: Invalid IFO for title 2 (VTS_02_0.BU).

to:

libdvdread: Invalid IFO for title 2 (VTS_02_0.BUP).

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/libdvdread.git/?a=commit;h=c3f1a56caa4f876ed3753935d95d93292cfd5ed7
---

 src/ifo_read.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

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);



More information about the libdvdnav-devel mailing list