[DVDnav-discuss] r922 - trunk/libdvdnav2/src/remap.c

nicodvb subversion at mplayerhq.hu
Sun Apr 29 13:46:59 CEST 2007


Author: nicodvb
Date: Sun Apr 29 13:46:59 2007
New Revision: 922

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

Modified:
   trunk/libdvdnav2/src/remap.c

Modified: trunk/libdvdnav2/src/remap.c
==============================================================================
--- trunk/libdvdnav2/src/remap.c	(original)
+++ trunk/libdvdnav2/src/remap.c	Sun Apr 29 13:46:59 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