changeset 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 6853c398600c
children d0b684fc4b1f
files remap.c
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
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");