[DVDnav-discuss] r1008 - trunk/libdvdnav/src/dvdnav.c

nicodvb subversion at mplayerhq.hu
Sat Apr 19 11:44:16 CEST 2008


Author: nicodvb
Date: Sat Apr 19 11:44:15 2008
New Revision: 1008

Log:
in dvdnav_open() make sure to NULL-terminate this->path and to not overrun its length; patch by Erik Hovland  - erik hovland org

Modified:
   trunk/libdvdnav/src/dvdnav.c

Modified: trunk/libdvdnav/src/dvdnav.c
==============================================================================
--- trunk/libdvdnav/src/dvdnav.c	(original)
+++ trunk/libdvdnav/src/dvdnav.c	Sat Apr 19 11:44:15 2008
@@ -108,7 +108,8 @@ dvdnav_status_t dvdnav_open(dvdnav_t** d
   }
 
   /* Set the path. FIXME: Is a deep copy 'right' */
-  strncpy(this->path, path, MAX_PATH_LEN);
+  strncpy(this->path, path, MAX_PATH_LEN - 1);
+  this->path[MAX_PATH_LEN - 1] = '\0';
 
   /* Pre-open and close a file so that the CSS-keys are cached. */
   this->file = DVDOpenFile(vm_get_dvd_reader(this->vm), 0, DVD_READ_MENU_VOBS);



More information about the DVDnav-discuss mailing list