[DVDnav-discuss] r882 - trunk/libdvdnav/src/remap.c

nicodvb subversion at mplayerhq.hu
Thu Apr 19 00:36:58 CEST 2007


Author: nicodvb
Date: Thu Apr 19 00:36:58 2007
New Revision: 882

Modified:
   trunk/libdvdnav/src/remap.c

Log:
replaced sequency of strncpy() and strncat() by 1 snprintf() and fixed off-by-1 possible buffer oveflow; patch by Diego Petteno'

Modified: trunk/libdvdnav/src/remap.c
==============================================================================
--- trunk/libdvdnav/src/remap.c	(original)
+++ trunk/libdvdnav/src/remap.c	Thu Apr 19 00:36:58 2007
@@ -190,10 +190,7 @@ remap_t* remap_loadmap( char *title) {
 
     /* Build the map filename */
     home = getenv("HOME"); assert(home);
-    strncpy(fname, home, sizeof(fname));
-    strncat(fname, "/.dvdnav/", sizeof(fname));
-    strncat(fname, title, sizeof(fname));
-    strncat(fname, ".map", sizeof(fname));
+    snprintf(fname, sizeof(fname), "%s/.dvdnav/%s.map", home, title);
 
     /* Open the map file */
     fp = fopen( fname, "r");



More information about the DVDnav-discuss mailing list