changeset 337:f08dbb15ece1 src

in dvdnav_open() make sure to NULL-terminate this->path and to not overrun its length; patch by Erik Hovland - erik hovland org
author nicodvb
date Sat, 19 Apr 2008 09:44:15 +0000
parents 63aad8298f28
children 0dc09442ff9c
files dvdnav.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/dvdnav.c	Sat Apr 19 09:40:03 2008 +0000
+++ b/dvdnav.c	Sat Apr 19 09:44:15 2008 +0000
@@ -108,7 +108,8 @@
   }
 
   /* 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);