kill some strcpy

This commit is contained in:
itojun 2004-04-21 18:16:14 +00:00
parent a01e0b0219
commit e133d13e80
5 changed files with 34 additions and 37 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ieee80211_ioctl.c,v 1.8 2004/01/16 14:07:32 onoe Exp $ */
/* $NetBSD: ieee80211_ioctl.c,v 1.9 2004/04/21 18:16:14 itojun Exp $ */
/*-
* Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
@ -35,7 +35,7 @@
#ifdef __FreeBSD__
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_ioctl.c,v 1.9 2003/11/13 05:23:58 sam Exp $");
#else
__KERNEL_RCSID(0, "$NetBSD: ieee80211_ioctl.c,v 1.8 2004/01/16 14:07:32 onoe Exp $");
__KERNEL_RCSID(0, "$NetBSD: ieee80211_ioctl.c,v 1.9 2004/04/21 18:16:14 itojun Exp $");
#endif
/*
@ -103,7 +103,8 @@ ieee80211_cfgget(struct ifnet *ifp, u_long cmd, caddr_t data)
/* nothing appropriate */
break;
case WI_RID_NODENAME:
strcpy((char *)&wreq.wi_val[1], hostname);
strlcpy((char *)&wreq.wi_val[1], hostname,
sizeof(wreq.wi_val) - sizeof(wreq.wi_val[0]));
wreq.wi_val[0] = htole16(strlen(hostname));
wreq.wi_len = (1 + strlen(hostname) + 1) / 2;
break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_pool.c,v 1.2 2004/03/28 09:01:26 martti Exp $ */
/* $NetBSD: ip_pool.c,v 1.3 2004/04/21 18:16:14 itojun Exp $ */
/*
* Copyright (C) 1993-2001, 2003 by Darren Reed.
@ -128,7 +128,7 @@ main(argc, argv)
bzero((char *)&b, sizeof(b));
bzero((char *)&ip, sizeof(ip));
bzero((char *)&op, sizeof(op));
strcpy(op.iplo_name, "0");
strlcpy(op.iplo_name, "0", sizeof(op.iplo_name));
if (ip_pool_create(&op) == 0)
ipo = ip_pool_find(0, "0");

View File

@ -1,9 +1,9 @@
/* $NetBSD: iconv.c,v 1.7 2003/05/16 05:14:40 itojun Exp $ */
/* $NetBSD: iconv.c,v 1.8 2004/04/21 18:16:14 itojun Exp $ */
/* Public domain */
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: iconv.c,v 1.7 2003/05/16 05:14:40 itojun Exp $");
__KERNEL_RCSID(0, "$NetBSD: iconv.c,v 1.8 2004/04/21 18:16:14 itojun Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -48,14 +48,14 @@ iconv_conv(void *handle, const char **inbuf,
}
char *
iconv_convstr(void *handle, char *dst, const char *src)
iconv_convstr(void *handle, char *dst, const char *src, size_t l)
{
char *p = dst;
size_t inlen, outlen;
int error;
if (handle == NULL) {
strcpy(dst, src); /*XXX need to know dstlen */
strlcpy(dst, src, l);
return dst;
}
inlen = outlen = strlen(src);

View File

@ -1,4 +1,4 @@
/* $NetBSD: iconv.h,v 1.5 2004/02/24 15:22:01 wiz Exp $ */
/* $NetBSD: iconv.h,v 1.6 2004/04/21 18:16:14 itojun Exp $ */
/*
* Copyright (c) 2000-2001, Boris Popov
@ -133,22 +133,21 @@ MALLOC_DECLARE(M_ICONV);
/*
* Basic conversion functions
*/
int iconv_open(const char *to, const char *from, void **handle);
int iconv_close(void *handle);
int iconv_conv(void *handle, const char **inbuf,
size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
char* iconv_convstr(void *handle, char *dst, const char *src);
void* iconv_convmem(void *handle, void *dst, const void *src, int size);
int iconv_open(const char *, const char *, void **);
int iconv_close(void *);
int iconv_conv(void *, const char **, size_t *, char **, size_t *);
char *iconv_convstr(void *, char *, const char *, size_t);
void *iconv_convmem(void *, void *, const void *, int);
/*
* Internal functions
*/
int iconv_lookupcp(const char **cpp, const char *s);
int iconv_lookupcp(const char **, const char *);
#ifndef __NetBSD__
int iconv_converter_initstub(struct iconv_converter_class *dp);
int iconv_converter_donestub(struct iconv_converter_class *dp);
int iconv_converter_handler(module_t mod, int type, void *data);
int iconv_converter_initstub(struct iconv_converter_class *);
int iconv_converter_donestub(struct iconv_converter_class *);
int iconv_converter_handler(module_t, int, void *);
#endif /* !NetBSD */
#ifdef ICONV_DEBUG

View File

@ -1,4 +1,4 @@
/* $NetBSD: smb_smb.c,v 1.21 2003/10/30 01:43:10 simonb Exp $ */
/* $NetBSD: smb_smb.c,v 1.22 2004/04/21 18:16:14 itojun Exp $ */
/*
* Copyright (c) 2000-2001 Boris Popov
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: smb_smb.c,v 1.21 2003/10/30 01:43:10 simonb Exp $");
__KERNEL_RCSID(0, "$NetBSD: smb_smb.c,v 1.22 2004/04/21 18:16:14 itojun Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -287,27 +287,26 @@ again:
*/
if (upper) {
iconv_convstr(vcp->vc_toupper, pbuf,
smb_vc_getpass(vcp)/*, SMB_MAXPASSWORDLEN*/);
smb_vc_getpass(vcp), SMB_MAXPASSWORDLEN + 1);
} else {
strncpy(pbuf, smb_vc_getpass(vcp), SMB_MAXPASSWORDLEN);
pbuf[SMB_MAXPASSWORDLEN] = '\0';
strlcpy(pbuf, smb_vc_getpass(vcp),
SMB_MAXPASSWORDLEN + 1);
}
if (!SMB_UNICODE_STRINGS(vcp))
iconv_convstr(vcp->vc_toserver, pbuf, pbuf/*,
SMB_MAXPASSWORDLEN*/);
iconv_convstr(vcp->vc_toserver, pbuf, pbuf,
SMB_MAXPASSWORDLEN + 1);
if (vcp->vc_sopt.sv_sm & SMB_SM_ENCRYPT) {
uniplen = plen = 24;
smb_encrypt(pbuf, vcp->vc_ch, encpass);
ntencpass = malloc(uniplen, M_SMBTEMP, M_WAITOK);
if (SMB_UNICODE_STRINGS(vcp)) {
strncpy(pbuf, smb_vc_getpass(vcp),
SMB_MAXPASSWORDLEN);
pbuf[SMB_MAXPASSWORDLEN] = '\0';
strlcpy(pbuf, smb_vc_getpass(vcp),
SMB_MAXPASSWORDLEN + 1);
} else
iconv_convstr(vcp->vc_toserver, pbuf,
smb_vc_getpass(vcp)/*,
SMB_MAXPASSWORDLEN*/);
smb_vc_getpass(vcp),
SMB_MAXPASSWORDLEN + 1);
smb_ntencrypt(pbuf, vcp->vc_ch, (u_char*)ntencpass);
pp = encpass;
unipp = ntencpass;
@ -507,12 +506,10 @@ again:
*/
if (upper) {
iconv_convstr(vcp->vc_toupper, pbuf,
smb_share_getpass(ssp)/*,
SMB_MAXPASSWORDLEN*/);
smb_share_getpass(ssp), SMB_MAXPASSWORDLEN + 1);
} else {
strncpy(pbuf, smb_share_getpass(ssp),
SMB_MAXPASSWORDLEN);
pbuf[SMB_MAXPASSWORDLEN] = '\0';
strlcpy(pbuf, smb_share_getpass(ssp),
SMB_MAXPASSWORDLEN + 1);
}
if (vcp->vc_sopt.sv_sm & SMB_SM_ENCRYPT) {
plen = 24;