summaryrefslogtreecommitdiff
path: root/usr.bin/systat/swap.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/systat/swap.c')
-rw-r--r--usr.bin/systat/swap.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/usr.bin/systat/swap.c b/usr.bin/systat/swap.c
index 3c27e1c992f8..33b56edddcc4 100644
--- a/usr.bin/systat/swap.c
+++ b/usr.bin/systat/swap.c
@@ -36,7 +36,7 @@
static char sccsid[] = "@(#)swap.c 8.3 (Berkeley) 4/29/95";
#endif
static const char rcsid[] =
- "$Id$";
+ "$Id: swap.c,v 1.5 1997/07/06 04:37:22 bde Exp $";
#endif /* not lint */
/*
@@ -122,17 +122,22 @@ initswap()
{
int i;
char msgbuf[BUFSIZ];
+ char *cp;
static int once = 0;
u_long ptr;
if (once)
return (1);
if (kvm_nlist(kd, syms)) {
- strcpy(msgbuf, "systat: swap: cannot find");
- for (i = 0; syms[i].n_name != NULL; i++) {
+ snprintf(msgbuf, sizeof(msgbuf), "systat: swap: cannot find");
+ cp = msgbuf + strlen(msgbuf) + 1;
+ for (i = 0;
+ syms[i].n_name != NULL && cp - msgbuf < sizeof(msgbuf);
+ i++) {
if (syms[i].n_value == 0) {
- strcat(msgbuf, " ");
- strcat(msgbuf, syms[i].n_name);
+ snprintf(cp, sizeof(msgbuf) - (cp - msgbuf),
+ " %s", syms[i].n_name);
+ cp += strlen(cp) + 1;
}
}
error(msgbuf);