[DVDnav-discuss] r988 - trunk/libdvdnav/src/dvdread/dvd_reader.c

nicodvb subversion at mplayerhq.hu
Mon Dec 31 19:08:06 CET 2007


Author: nicodvb
Date: Mon Dec 31 19:08:06 2007
New Revision: 988

Log:
malloc() a buffer large enough before calling getcwd() - part of ogle-1778

Modified:
   trunk/libdvdnav/src/dvdread/dvd_reader.c

Modified: trunk/libdvdnav/src/dvdread/dvd_reader.c
==============================================================================
--- trunk/libdvdnav/src/dvdread/dvd_reader.c	(original)
+++ trunk/libdvdnav/src/dvdread/dvd_reader.c	Mon Dec 31 19:08:06 2007
@@ -418,13 +418,16 @@ dvd_reader_t *DVDOpen( const char *ppath
 	    
 	    if( cdir >= 0 ) {
 		chdir( path_copy );
-		new_path = getcwd( NULL, PATH_MAX );
+		new_path = malloc(PATH_MAX+1);
+		if(!new_path) {
+		  free(path);
+		  return NULL;
+		}
+		getcwd(new_path, PATH_MAX );
 		fchdir( cdir );
 		close( cdir );
-		if( new_path ) {
 		    free( path_copy );
 		    path_copy = new_path;
-		}
 	    }
 	}
 #endif	



More information about the DVDnav-discuss mailing list