summaryrefslogtreecommitdiff
path: root/lib/libkvm
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-11-17 20:25:19 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-11-17 20:25:19 +0000
commit5dfb895ccfb7a82c8990d424498f20e2302bc80c (patch)
treee5e836a59a7587e98b03b128ddddb2b53520dd01 /lib/libkvm
parentc4e92ea1971e91f97ce63aa0d9dda183219d2768 (diff)
Zero nlist array before using; fixes a bug in the error condition
when the corefile is not a valid executable. otto@ OK
Diffstat (limited to 'lib/libkvm')
-rw-r--r--lib/libkvm/kvm_proc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libkvm/kvm_proc.c b/lib/libkvm/kvm_proc.c
index d4f185a1217..c3683e49f48 100644
--- a/lib/libkvm/kvm_proc.c
+++ b/lib/libkvm/kvm_proc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kvm_proc.c,v 1.18 2003/08/06 21:08:05 millert Exp $ */
+/* $OpenBSD: kvm_proc.c,v 1.19 2003/11/17 20:25:18 millert Exp $ */
/* $NetBSD: kvm_proc.c,v 1.30 1999/03/24 05:50:50 mrg Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
#if 0
static char sccsid[] = "@(#)kvm_proc.c 8.3 (Berkeley) 9/23/93";
#else
-static char *rcsid = "$OpenBSD: kvm_proc.c,v 1.18 2003/08/06 21:08:05 millert Exp $";
+static char *rcsid = "$OpenBSD: kvm_proc.c,v 1.19 2003/11/17 20:25:18 millert Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
@@ -421,10 +421,11 @@ kvm_getprocs(kd, op, arg, cnt)
} else {
struct nlist nl[4], *p;
+ memset(nl, 0, sizeof(nl));
nl[0].n_name = "_nprocs";
nl[1].n_name = "_allproc";
nl[2].n_name = "_zombproc";
- nl[3].n_name = 0;
+ nl[3].n_name = NULL;
if (kvm_nlist(kd, nl) != 0) {
for (p = nl; p->n_type != 0; ++p)