Replace strcat and strcpy with strncat, strncpy.

This commit is contained in:
rocky
2006-03-17 22:36:31 +00:00
parent 25a76d78cb
commit 611fc94450
3 changed files with 13 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
/*
$Id: iso9660.c,v 1.23 2006/03/17 13:00:43 rocky Exp $
$Id: iso9660.c,v 1.24 2006/03/17 22:36:31 rocky Exp $
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003, 2004, 2005, 2006 Rocky Bernstein <rocky@panix.com>
@@ -54,7 +54,7 @@ const char ISO_STANDARD_ID[] = {'C', 'D', '0', '0', '1'};
#include <errno.h>
#endif
static const char _rcsid[] = "$Id: iso9660.c,v 1.23 2006/03/17 13:00:43 rocky Exp $";
static const char _rcsid[] = "$Id: iso9660.c,v 1.24 2006/03/17 22:36:31 rocky Exp $";
/* Variables to hold debugger-helping enumerations */
enum iso_enum1_s iso_enums1;
@@ -515,7 +515,8 @@ iso9660_set_pvd(void *pd,
memset(&ipd,0,sizeof(ipd)); /* paranoia? */
/* magic stuff ... thatis CD XA marker... */
strcpy(((char*)&ipd)+ISO_XA_MARKER_OFFSET, ISO_XA_MARKER_STRING);
strncpy(((char*)&ipd)+ISO_XA_MARKER_OFFSET, ISO_XA_MARKER_STRING,
sizeof(ISO_XA_MARKER_STRING));
ipd.type = to_711(ISO_VD_PRIMARY);
iso9660_strncpy_pad (ipd.id, ISO_STANDARD_ID, 5, ISO9660_DCHARS);

View File

@@ -1,5 +1,5 @@
/*
$Id: iso9660_fs.c,v 1.34 2006/03/14 11:40:05 rocky Exp $
$Id: iso9660_fs.c,v 1.35 2006/03/17 22:36:31 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003, 2004, 2005, 2006 Rocky Bernstein <rocky@panix.com>
@@ -53,7 +53,7 @@
#include <stdio.h>
static const char _rcsid[] = "$Id: iso9660_fs.c,v 1.34 2006/03/14 11:40:05 rocky Exp $";
static const char _rcsid[] = "$Id: iso9660_fs.c,v 1.35 2006/03/17 22:36:31 rocky Exp $";
/* Implementation of iso9660_t type */
struct _iso9660_s {
@@ -837,9 +837,9 @@ _iso9660_dir_to_statbuf (iso9660_dir_t *p_iso9660_dir, bool_3way_t b_xa,
strncpy(p_stat->filename, rr_fname, i_rr_fname+1);
} else {
if ('\0' == p_iso9660_dir->filename[0] && 1 == i_fname)
strcpy (p_stat->filename, ".");
strncpy (p_stat->filename, ".", sizeof("."));
else if ('\1' == p_iso9660_dir->filename[0] && 1 == i_fname)
strcpy (p_stat->filename, "..");
strncpy (p_stat->filename, "..", sizeof(".."));
#ifdef HAVE_JOLIET
else if (i_joliet_level) {
int i_inlen = i_fname;
@@ -927,9 +927,9 @@ iso9660_dir_to_name (const iso9660_dir_t *iso9660_dir)
/* (iso9660_dir->file_flags & ISO_DIRECTORY) */
if (iso9660_dir->filename[0] == '\0')
strcpy (namebuf, ".");
strncpy (namebuf, ".", sizeof("."));
else if (iso9660_dir->filename[0] == '\1')
strcpy (namebuf, "..");
strncpy (namebuf, "..", sizeof(".."));
else
strncpy (namebuf, iso9660_dir->filename, iso9660_dir->filename_len);

View File

@@ -1,5 +1,5 @@
/*
$Id: rock.c,v 1.16 2005/11/06 20:02:39 rocky Exp $
$Id: rock.c,v 1.17 2006/03/17 22:36:31 rocky Exp $
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
Adapted from GNU/Linux fs/isofs/rock.c (C) 1992, 1993 Eric Youngdale
@@ -202,11 +202,10 @@ get_rock_ridge_filename(iso9660_dir_t * p_iso9660_dir,
if (truncate) break;
if (rr->u.NM.flags & ISO_ROCK_NM_PARENT) {
i_namelen = sizeof("..");
strcat(psz_name, "..");
break;
strncat(psz_name, "..", i_namelen);
} else if (rr->u.NM.flags & ISO_ROCK_NM_CURRENT) {
i_namelen = sizeof(".");
strcat(psz_name, ".");
strncat(psz_name, ".", i_namelen);
break;
}