use bounded string op
This commit is contained in:
parent
8556dff80c
commit
e97c220e91
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: docmd.c,v 1.23 2003/07/12 13:41:21 itojun Exp $ */
|
||||
/* $NetBSD: docmd.c,v 1.24 2003/07/23 04:11:12 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)docmd.c 8.1 (Berkeley) 6/9/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: docmd.c,v 1.23 2003/07/12 13:41:21 itojun Exp $");
|
||||
__RCSID("$NetBSD: docmd.c,v 1.24 2003/07/23 04:11:12 itojun Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -335,7 +335,7 @@ lostconn(int signo)
|
||||
}
|
||||
|
||||
if (nr <= 0)
|
||||
(void) strcpy(buf, "lost connection");
|
||||
(void) strlcpy(buf, "lost connection", sizeof(buf));
|
||||
|
||||
if (iamremote)
|
||||
cleanup(0);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: expand.c,v 1.14 2002/06/14 01:18:54 wiz Exp $ */
|
||||
/* $NetBSD: expand.c,v 1.15 2003/07/23 04:11:12 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)expand.c 8.1 (Berkeley) 6/9/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: expand.c,v 1.14 2002/06/14 01:18:54 wiz Exp $");
|
||||
__RCSID("$NetBSD: expand.c,v 1.15 2003/07/23 04:11:12 itojun Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -218,7 +218,8 @@ expstr(char *s)
|
||||
*cp1 = '\0';
|
||||
if (pw == NULL || strcmp(pw->pw_name, buf+1) != 0) {
|
||||
if ((pw = getpwnam(buf+1)) == NULL) {
|
||||
strcat(buf, ": unknown user name");
|
||||
strlcat(buf, ": unknown user name",
|
||||
sizeof(buf));
|
||||
yyerror(buf+1);
|
||||
return;
|
||||
}
|
||||
@ -393,8 +394,8 @@ pend:
|
||||
doit:
|
||||
savec = *pm;
|
||||
*pm = 0;
|
||||
strcpy(lm, pl);
|
||||
strcat(restbuf, pe + 1);
|
||||
strlcpy(lm, pl, sizeof(restbuf) - (lm - restbuf));
|
||||
strlcat(restbuf, pe + 1, sizeof(restbuf));
|
||||
*pm = savec;
|
||||
if (s == 0) {
|
||||
spathp = pathp;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: main.c,v 1.13 2002/06/14 01:18:55 wiz Exp $ */
|
||||
/* $NetBSD: main.c,v 1.14 2003/07/23 04:11:13 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/9/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: main.c,v 1.13 2002/06/14 01:18:55 wiz Exp $");
|
||||
__RCSID("$NetBSD: main.c,v 1.14 2003/07/23 04:11:13 itojun Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -101,13 +101,13 @@ main(int argc, char **argv)
|
||||
fprintf(stderr, "%s: Who are you?\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
strcpy(user, pw->pw_name);
|
||||
strcpy(homedir, pw->pw_dir);
|
||||
strlcpy(user, pw->pw_name, sizeof(user));
|
||||
strlcpy(homedir, pw->pw_dir, sizeof(homedir));
|
||||
groupid = pw->pw_gid;
|
||||
gethostname(host, sizeof(host));
|
||||
host[sizeof(host) - 1] = '\0';
|
||||
strcpy(tempfile, _PATH_TMP);
|
||||
strcat(tempfile, _RDIST_TMP);
|
||||
strlcpy(tempfile, _PATH_TMP, sizeof(tempfile));
|
||||
strlcat(tempfile, _RDIST_TMP, sizeof(tempfile));
|
||||
if ((tempname = strrchr(tempfile, '/')) != 0)
|
||||
tempname++;
|
||||
else
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: server.c,v 1.25 2003/01/20 05:30:12 simonb Exp $ */
|
||||
/* $NetBSD: server.c,v 1.26 2003/07/23 04:11:13 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)server.c 8.1 (Berkeley) 6/9/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: server.c,v 1.25 2003/01/20 05:30:12 simonb Exp $");
|
||||
__RCSID("$NetBSD: server.c,v 1.26 2003/07/23 04:11:13 itojun Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -301,7 +301,7 @@ install(char *src, char *dest, int destdir, int opts)
|
||||
return;
|
||||
|
||||
if (destdir) {
|
||||
strcpy(destcopy, dest);
|
||||
strlcpy(destcopy, dest, sizeof(destcopy));
|
||||
Tdest = destcopy;
|
||||
}
|
||||
sendf(rname, opts);
|
||||
@ -571,9 +571,9 @@ savelink(struct stat *stp)
|
||||
lp->inum = stp->st_ino;
|
||||
lp->devnum = stp->st_dev;
|
||||
lp->count = stp->st_nlink - 1;
|
||||
strcpy(lp->pathname, target);
|
||||
strlcpy(lp->pathname, target, sizeof(lp->pathname));
|
||||
if (Tdest)
|
||||
strcpy(lp->target, Tdest);
|
||||
strlcpy(lp->target, Tdest, sizeof(lp->target));
|
||||
else
|
||||
*lp->target = 0;
|
||||
}
|
||||
@ -831,7 +831,7 @@ recvf(char *cmd, int type)
|
||||
(void) snprintf(tp, sizeof(target) - (tp - target), "/%s", cp);
|
||||
cp = strrchr(target, '/');
|
||||
if (cp == NULL)
|
||||
strcpy(new, tempname);
|
||||
strlcpy(new, tempname, sizeof(new));
|
||||
else if (cp == target)
|
||||
(void) snprintf(new, sizeof(new), "/%s", tempname);
|
||||
else {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: skeyinfo.c,v 1.3 1997/11/08 09:37:44 lukem Exp $ */
|
||||
/* $NetBSD: skeyinfo.c,v 1.4 2003/07/23 04:11:50 itojun Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
@ -38,7 +38,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: skeyinfo.c,v 1.3 1997/11/08 09:37:44 lukem Exp $");
|
||||
__RCSID("$NetBSD: skeyinfo.c,v 1.4 2003/07/23 04:11:50 itojun Exp $");
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
@ -82,8 +82,7 @@ main(argc, argv)
|
||||
errx(1, "who are you?");
|
||||
}
|
||||
|
||||
(void) strncpy(name, pw->pw_name, sizeof(name));
|
||||
name[sizeof(name) - 1] = '\0';
|
||||
(void) strlcpy(name, pw->pw_name, sizeof(name));
|
||||
|
||||
if (getskeyprompt(&skey, name, prompt) == -1) {
|
||||
printf("%s %s no s/key\n",
|
||||
|
Loading…
Reference in New Issue
Block a user