Mercurial > libdvdnav.hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
281:6853c398600c | 282:918fe20358cb |
---|---|
188 block_t tmp; | 188 block_t tmp; |
189 remap_t *map; | 189 remap_t *map; |
190 | 190 |
191 /* Build the map filename */ | 191 /* Build the map filename */ |
192 home = getenv("HOME"); assert(home); | 192 home = getenv("HOME"); assert(home); |
193 strncpy(fname, home, sizeof(fname)); | 193 snprintf(fname, sizeof(fname), "%s/.dvdnav/%s.map", home, title); |
194 strncat(fname, "/.dvdnav/", sizeof(fname)); | |
195 strncat(fname, title, sizeof(fname)); | |
196 strncat(fname, ".map", sizeof(fname)); | |
197 | 194 |
198 /* Open the map file */ | 195 /* Open the map file */ |
199 fp = fopen( fname, "r"); | 196 fp = fopen( fname, "r"); |
200 if (!fp) { | 197 if (!fp) { |
201 fprintf(MSG_OUT, "libdvdnav: Unable to find map file '%s'\n", fname); | 198 fprintf(MSG_OUT, "libdvdnav: Unable to find map file '%s'\n", fname); |