diff options
author | 1997-12-19 09:22:55 +0000 | |
---|---|---|
committer | 1997-12-19 09:22:55 +0000 | |
commit | 45bde984976f16104271fb14055ec34307154adf (patch) | |
tree | 61193915f43d9c8a1cc678840b8bbbe5fdfa9966 | |
parent | make mountd abort if getfh() not supported. reported by newsham@secnet.com, fixed by me (diff) | |
download | wireguard-openbsd-45bde984976f16104271fb14055ec34307154adf.tar.xz wireguard-openbsd-45bde984976f16104271fb14055ec34307154adf.zip |
proactive buffer blocks
-rw-r--r-- | usr.bin/systat/netstat.c | 16 | ||||
-rw-r--r-- | usr.bin/systat/vmstat.c | 7 |
2 files changed, 13 insertions, 10 deletions
diff --git a/usr.bin/systat/netstat.c b/usr.bin/systat/netstat.c index 6d69352c89d..5e9ceaeba31 100644 --- a/usr.bin/systat/netstat.c +++ b/usr.bin/systat/netstat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: netstat.c,v 1.8 1997/12/19 09:03:33 deraadt Exp $ */ +/* $OpenBSD: netstat.c,v 1.9 1997/12/19 09:22:55 deraadt Exp $ */ /* $NetBSD: netstat.c,v 1.3 1995/06/18 23:53:07 cgd Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)netstat.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: netstat.c,v 1.8 1997/12/19 09:03:33 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: netstat.c,v 1.9 1997/12/19 09:22:55 deraadt Exp $"; #endif /* not lint */ /* @@ -435,11 +435,13 @@ inetname(in) cp = hp->h_name; } } - if (in.s_addr == INADDR_ANY) - strcpy(line, "*"); - else if (cp) - strncpy(line, cp, sizeof line); - else { + if (in.s_addr == INADDR_ANY) { + strncpy(line, "*", sizeof line-1); + line[sizeof line-1] = '\0'; + } else if (cp) { + strncpy(line, cp, sizeof line-1); + line[sizeof line-1] = '\0'; + } else { in.s_addr = ntohl(in.s_addr); #define C(x) ((x) & 0xff) snprintf(line, sizeof line, "%u.%u.%u.%u", C(in.s_addr >> 24), diff --git a/usr.bin/systat/vmstat.c b/usr.bin/systat/vmstat.c index 7da0c31fcfa..a8694e20ad4 100644 --- a/usr.bin/systat/vmstat.c +++ b/usr.bin/systat/vmstat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmstat.c,v 1.12 1997/12/19 09:03:34 deraadt Exp $ */ +/* $OpenBSD: vmstat.c,v 1.13 1997/12/19 09:22:56 deraadt Exp $ */ /* $NetBSD: vmstat.c,v 1.5 1996/05/10 23:16:40 thorpej Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 1/12/94"; #endif -static char rcsid[] = "$OpenBSD: vmstat.c,v 1.12 1997/12/19 09:03:34 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: vmstat.c,v 1.13 1997/12/19 09:22:56 deraadt Exp $"; #endif /* not lint */ /* @@ -298,7 +298,8 @@ fetchkre() time_t now; time(&now); - strcpy(buf, ctime(&now)); + strncpy(buf, ctime(&now), sizeof buf-1); + buf[sizeof buf-1] = '\0'; getinfo(&s, state); } |