diff remap.c @ 282:918fe20358cb src

replaced sequency of strncpy() and strncat() by 1 snprintf() and fixed off-by-1 possible buffer oveflow; patch by Diego Petteno'
author nicodvb
date Wed, 18 Apr 2007 22:36:58 +0000
parents 6b67914ae021
children 52877d182e96
line wrap: on
line diff
--- a/remap.c	Wed Apr 18 22:34:52 2007 +0000
+++ b/remap.c	Wed Apr 18 22:36:58 2007 +0000
@@ -190,10 +190,7 @@
 
     /* 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");