use strlcpy

[compat/svr4_32 should have bound check for SVR4_32_AUX_ARGSIZ]
This commit is contained in:
itojun 2003-05-16 14:36:30 +00:00
parent f265a4a4da
commit 51110d0c20
10 changed files with 38 additions and 37 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ibcs2_misc.c,v 1.63 2003/01/29 07:00:35 atatat Exp $ */
/* $NetBSD: ibcs2_misc.c,v 1.64 2003/05/16 14:36:30 itojun Exp $ */
/*
* Copyright (c) 1994, 1995, 1998 Scott Bartram
@ -55,7 +55,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ibcs2_misc.c,v 1.63 2003/01/29 07:00:35 atatat Exp $");
__KERNEL_RCSID(0, "$NetBSD: ibcs2_misc.c,v 1.64 2003/05/16 14:36:30 itojun Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -451,7 +451,7 @@ again:
idb.d_ino = (ibcs2_ino_t)bdp->d_fileno;
idb.d_off = (ibcs2_off_t)off;
idb.d_reclen = (u_short)ibcs2_reclen;
strcpy(idb.d_name, bdp->d_name);
strlcpy(idb.d_name, bdp->d_name, sizeof(idb.d_name));
error = copyout(&idb, outp, ibcs2_reclen);
if (error)
goto out;

View File

@ -1,4 +1,4 @@
/* $NetBSD: irix_dirent.c,v 1.8 2003/01/22 12:58:22 rafal Exp $ */
/* $NetBSD: irix_dirent.c,v 1.9 2003/05/16 14:36:32 itojun Exp $ */
/*-
* Copyright (c) 1994, 2001 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_dirent.c,v 1.8 2003/01/22 12:58:22 rafal Exp $");
__KERNEL_RCSID(0, "$NetBSD: irix_dirent.c,v 1.9 2003/05/16 14:36:32 itojun Exp $");
#include <sys/types.h>
#include <sys/signal.h>
@ -171,7 +171,7 @@ again:
idb.d_ino = (irix_ino_t)bdp->d_fileno;
idb.d_off = (irix_off_t)off;
idb.d_reclen = (u_short)svr4_reclen;
strcpy(idb.d_name, bdp->d_name);
strlcpy(idb.d_name, bdp->d_name, sizeof(idb.d_name));
if ((error = copyout((caddr_t)&idb, outp, svr4_reclen)))
goto out;
/* advance past this real entry */
@ -324,7 +324,7 @@ again:
idb.d_ino = (irix_ino64_t)bdp->d_fileno;
idb.d_off = (irix_off64_t)off;
idb.d_reclen = (u_short)svr4_reclen;
strcpy(idb.d_name, bdp->d_name);
strlcpy(idb.d_name, bdp->d_name, sizeof(idb.d_name));
if ((error = copyout((caddr_t)&idb, outp, svr4_reclen)))
goto out;
/* advance past this real entry */

View File

@ -1,4 +1,4 @@
/* $NetBSD: irix_stat.c,v 1.7 2003/01/22 12:58:23 rafal Exp $ */
/* $NetBSD: irix_stat.c,v 1.8 2003/05/16 14:36:32 itojun Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_stat.c,v 1.7 2003/01/22 12:58:23 rafal Exp $");
__KERNEL_RCSID(0, "$NetBSD: irix_stat.c,v 1.8 2003/05/16 14:36:32 itojun Exp $");
#include <sys/errno.h>
#include <sys/types.h>
@ -90,7 +90,7 @@ bsd_to_irix_stat(bsp, isp)
isp->ist_size = bsp->st_size;
isp->ist_blocks = bsp->st_blocks;
isp->ist_blksize = bsp->st_blksize;
strcpy(isp->ist_fstype, "unknown");
strlcpy(isp->ist_fstype, "unknown", sizeof(isp->ist_fstype));
return;
}
@ -122,7 +122,7 @@ bsd_to_irix_stat64(bsp, isp)
isp->ist_size = bsp->st_size;
isp->ist_blocks = bsp->st_blocks;
isp->ist_blksize = bsp->st_blksize;
strcpy(isp->ist_fstype, "unknown");
strlcpy(isp->ist_fstype, "unknown", sizeof(isp->ist_fstype));
return;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: mach_bootstrap.c,v 1.5 2003/01/21 04:06:07 matt Exp $ */
/* $NetBSD: mach_bootstrap.c,v 1.6 2003/05/16 14:36:33 itojun Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mach_bootstrap.c,v 1.5 2003/01/21 04:06:07 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: mach_bootstrap.c,v 1.6 2003/05/16 14:36:33 itojun Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -59,7 +59,7 @@ mach_bootstrap_look_up(args)
mach_bootstrap_look_up_reply_t *rep = args->rmsg;
struct lwp *l = args->l;
size_t *msglen = args->rsize;
const char service_name[] = "lookup\21"; /* XXX Why */
const char service_name[] = "lookup\021"; /* XXX Why */
int service_name_len;
struct mach_right *mr;
@ -79,7 +79,8 @@ mach_bootstrap_look_up(args)
rep->rep_msgh.msgh_id = req->req_msgh.msgh_id + 100;
rep->rep_count = 1; /* XXX Why? */
rep->rep_bootstrap_port = mr->mr_name;
strcpy((char *)&rep->rep_service_name, service_name);
strlcpy((char *)&rep->rep_service_name, service_name,
sizeof(rep->rep_service_name));
/* XXX This is the trailer. We should find something better */
rep->rep_service_name[service_name_len + 7] = 8;

View File

@ -1,4 +1,4 @@
/* $NetBSD: sunos_misc.c,v 1.120 2003/02/23 14:37:32 pk Exp $ */
/* $NetBSD: sunos_misc.c,v 1.121 2003/05/16 14:36:33 itojun Exp $ */
/*
* Copyright (c) 1992, 1993
@ -54,7 +54,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sunos_misc.c,v 1.120 2003/02/23 14:37:32 pk Exp $");
__KERNEL_RCSID(0, "$NetBSD: sunos_misc.c,v 1.121 2003/05/16 14:36:33 itojun Exp $");
#if defined(_KERNEL_OPT)
#include "opt_nfsserver.h"
@ -577,7 +577,7 @@ again:
idb.d_off = off;
idb.d_reclen = sunos_reclen;
idb.d_namlen = bdp->d_namlen;
strcpy(idb.d_name, bdp->d_name);
strlcpy(idb.d_name, bdp->d_name, sizeof(idb.d_name));
if ((error = copyout((caddr_t)&idb, outp, sunos_reclen)) != 0)
goto out;
/* advance past this real entry */

View File

@ -1,4 +1,4 @@
/* $NetBSD: sunos32_misc.c,v 1.17 2003/01/29 07:00:38 atatat Exp $ */
/* $NetBSD: sunos32_misc.c,v 1.18 2003/05/16 14:36:34 itojun Exp $ */
/* from :NetBSD: sunos_misc.c,v 1.107 2000/12/01 19:25:10 jdolecek Exp */
/*
@ -83,7 +83,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sunos32_misc.c,v 1.17 2003/01/29 07:00:38 atatat Exp $");
__KERNEL_RCSID(0, "$NetBSD: sunos32_misc.c,v 1.18 2003/05/16 14:36:34 itojun Exp $");
#define COMPAT_SUNOS 1
@ -795,7 +795,7 @@ again:
idb.d_off = off;
idb.d_reclen = sunos_reclen;
idb.d_namlen = bdp->d_namlen;
strcpy(idb.d_name, bdp->d_name);
strlcpy(idb.d_name, bdp->d_name, sizeof(idb.d_name));
if ((error = copyout((caddr_t)&idb, outp, sunos_reclen)) != 0)
goto out;
/* advance past this real entry */

View File

@ -1,4 +1,4 @@
/* $NetBSD: svr4_misc.c,v 1.103 2003/04/01 01:55:09 thorpej Exp $ */
/* $NetBSD: svr4_misc.c,v 1.104 2003/05/16 14:36:35 itojun Exp $ */
/*-
* Copyright (c) 1994 The NetBSD Foundation, Inc.
@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: svr4_misc.c,v 1.103 2003/04/01 01:55:09 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: svr4_misc.c,v 1.104 2003/05/16 14:36:35 itojun Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -345,7 +345,7 @@ again:
idb.d_ino = (svr4_ino64_t)bdp->d_fileno;
idb.d_off = (svr4_off64_t)off;
idb.d_reclen = (u_short)svr4_reclen;
strcpy(idb.d_name, bdp->d_name);
strlcpy(idb.d_name, bdp->d_name, sizeof(idb.d_name));
if ((error = copyout((caddr_t)&idb, outp, svr4_reclen)))
goto out;
/* advance past this real entry */
@ -469,7 +469,7 @@ again:
idb.d_ino = (svr4_ino_t)bdp->d_fileno;
idb.d_off = (svr4_off_t)off;
idb.d_reclen = (u_short)svr4_reclen;
strcpy(idb.d_name, bdp->d_name);
strlcpy(idb.d_name, bdp->d_name, sizeof(idb.d_name));
if ((error = copyout((caddr_t)&idb, outp, svr4_reclen)))
goto out;
/* advance past this real entry */

View File

@ -1,4 +1,4 @@
/* $NetBSD: svr4_stat.c,v 1.46 2003/01/18 08:44:27 thorpej Exp $ */
/* $NetBSD: svr4_stat.c,v 1.47 2003/05/16 14:36:35 itojun Exp $ */
/*-
* Copyright (c) 1994 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: svr4_stat.c,v 1.46 2003/01/18 08:44:27 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: svr4_stat.c,v 1.47 2003/05/16 14:36:35 itojun Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -140,7 +140,7 @@ bsd_to_svr4_xstat(st, st4)
st4->st_ctim.tv_nsec = st->st_ctimespec.tv_nsec;
st4->st_blksize = st->st_blksize;
st4->st_blocks = st->st_blocks;
strcpy(st4->st_fstype, "unknown");
strlcpy(st4->st_fstype, "unknown", sizeof(st4->st_fstype));
}
@ -166,7 +166,7 @@ bsd_to_svr4_stat64(st, st4)
st4->st_ctim.tv_nsec = st->st_ctimespec.tv_nsec;
st4->st_blksize = st->st_blksize;
st4->st_blocks = st->st_blocks;
strcpy(st4->st_fstype, "unknown");
strlcpy(st4->st_fstype, "unknown", sizeof(st4->st_fstype));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: svr4_32_misc.c,v 1.18 2003/04/01 01:55:38 thorpej Exp $ */
/* $NetBSD: svr4_32_misc.c,v 1.19 2003/05/16 14:36:35 itojun Exp $ */
/*-
* Copyright (c) 1994 The NetBSD Foundation, Inc.
@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: svr4_32_misc.c,v 1.18 2003/04/01 01:55:38 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: svr4_32_misc.c,v 1.19 2003/05/16 14:36:35 itojun Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -347,7 +347,7 @@ again:
idb.d_ino = (svr4_32_ino64_t)bdp->d_fileno;
idb.d_off = (svr4_32_off64_t)off;
idb.d_reclen = (u_short)svr4_32_reclen;
strcpy(idb.d_name, bdp->d_name);
strlcpy(idb.d_name, bdp->d_name, sizeof(idb.d_name));
if ((error = copyout((caddr_t)&idb, outp, svr4_32_reclen)))
goto out;
/* advance past this real entry */
@ -471,7 +471,7 @@ again:
idb.d_ino = (svr4_32_ino_t)bdp->d_fileno;
idb.d_off = (svr4_32_off_t)off;
idb.d_reclen = (u_short)svr4_reclen;
strcpy(idb.d_name, bdp->d_name);
strlcpy(idb.d_name, bdp->d_name, sizeof(idb.d_name));
if ((error = copyout((caddr_t)&idb, outp, svr4_reclen)))
goto out;
/* advance past this real entry */

View File

@ -1,4 +1,4 @@
/* $NetBSD: svr4_32_stat.c,v 1.7 2003/01/19 16:47:16 thorpej Exp $ */
/* $NetBSD: svr4_32_stat.c,v 1.8 2003/05/16 14:36:36 itojun Exp $ */
/*-
* Copyright (c) 1994 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: svr4_32_stat.c,v 1.7 2003/01/19 16:47:16 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: svr4_32_stat.c,v 1.8 2003/05/16 14:36:36 itojun Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -140,7 +140,7 @@ bsd_to_svr4_32_xstat(st, st4)
st4->st_ctim.tv_nsec = st->st_ctimespec.tv_nsec;
st4->st_blksize = st->st_blksize;
st4->st_blocks = st->st_blocks;
strcpy(st4->st_fstype, "unknown");
strlcpy(st4->st_fstype, "unknown", sizeof(st4->st_fstype));
}
@ -165,7 +165,7 @@ bsd_to_svr4_32_stat64(st, st4)
st4->st_ctim.tv_sec = st->st_ctimespec.tv_sec;
st4->st_ctim.tv_nsec = st->st_ctimespec.tv_nsec;
st4->st_blocks = st->st_blocks;
strcpy(st4->st_fstype, "unknown");
strlcpy(st4->st_fstype, "unknown", sizeof(st4->st_fstype));
}