check return value of kvm_read() more safe
This commit is contained in:
parent
4229b1a8cc
commit
d4d8503fa5
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: fstat.c,v 1.24 1997/10/20 00:00:49 thorpej Exp $ */
|
||||
/* $NetBSD: fstat.c,v 1.25 1998/07/03 15:49:25 msaitoh Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1988, 1993
|
||||
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1993\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)fstat.c 8.3 (Berkeley) 5/2/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: fstat.c,v 1.24 1997/10/20 00:00:49 thorpej Exp $");
|
||||
__RCSID("$NetBSD: fstat.c,v 1.25 1998/07/03 15:49:25 msaitoh Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -656,7 +656,7 @@ socktrans(sock, i)
|
||||
}
|
||||
|
||||
if ((len = kvm_read(kd, (u_long)dom.dom_name, dname,
|
||||
sizeof(dname) - 1)) < 0) {
|
||||
sizeof(dname) - 1)) != sizeof(dname) -1) {
|
||||
dprintf(stderr, "can't read domain name at %lx\n",
|
||||
(long)dom.dom_name);
|
||||
dname[0] = '\0';
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nfsstat.c,v 1.11 1998/03/27 02:40:38 hubertf Exp $ */
|
||||
/* $NetBSD: nfsstat.c,v 1.12 1998/07/03 15:49:25 msaitoh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1989, 1993
|
||||
@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1989, 1993\n\
|
||||
#if 0
|
||||
static char sccsid[] = "from: @(#)nfsstat.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: nfsstat.c,v 1.11 1998/03/27 02:40:38 hubertf Exp $");
|
||||
__RCSID("$NetBSD: nfsstat.c,v 1.12 1998/07/03 15:49:25 msaitoh Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -168,8 +168,8 @@ intpr(nfsstataddr)
|
||||
{
|
||||
struct nfsstats nfsstats;
|
||||
|
||||
if (kvm_read(kd, (u_long)nfsstataddr,
|
||||
(char *)&nfsstats, sizeof(struct nfsstats)) < 0)
|
||||
if (kvm_read(kd, (u_long)nfsstataddr, (char *)&nfsstats,
|
||||
sizeof(struct nfsstats)) != sizeof(struct nfsstats))
|
||||
errx(1, "kvm_read failed");
|
||||
if (printall || clientinfo){
|
||||
printf("Client Info:\n");
|
||||
@ -339,7 +339,8 @@ sidewaysintpr(interval, off)
|
||||
printhdr();
|
||||
hdrcnt = 20;
|
||||
}
|
||||
if (kvm_read(kd, off, (char *)&nfsstats, sizeof nfsstats) < 0)
|
||||
if (kvm_read(kd, off, (char *)&nfsstats, sizeof(nfsstats))
|
||||
!= sizeof(nfsstats))
|
||||
errx(1, "kvm_read failed");
|
||||
if (printall || clientinfo)
|
||||
printf("Client: %8d %8d %8d %8d %8d %8d %8d %8d\n",
|
||||
|
Loading…
Reference in New Issue
Block a user