aboutsummaryrefslogtreecommitdiff
path: root/lib/libkvm
diff options
context:
space:
mode:
authorDavid Malone <dwmalone@FreeBSD.org>2001-05-03 11:26:46 +0000
committerDavid Malone <dwmalone@FreeBSD.org>2001-05-03 11:26:46 +0000
commitd339edcf66f366e4a6a97e163b434f185e8013d0 (patch)
tree0a8eaf3f1ef1c7df90d03a078a7f966398bb3f86 /lib/libkvm
parent556a280696d39edd97cd03ed7c61d8c01d2ccd88 (diff)
downloadsrc-d339edcf66f366e4a6a97e163b434f185e8013d0.tar.gz
src-d339edcf66f366e4a6a97e163b434f185e8013d0.zip
Avoid dividing by zero if kd->procbase->ki_structsize is uninitalised.
(I'm testing the numerator rather than the denominator, which looks weird, but is the right thing to do here).
Notes
Notes: svn path=/head/; revision=76243
Diffstat (limited to 'lib/libkvm')
-rw-r--r--lib/libkvm/kvm_proc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libkvm/kvm_proc.c b/lib/libkvm/kvm_proc.c
index 96661c1b1759..d31392522abd 100644
--- a/lib/libkvm/kvm_proc.c
+++ b/lib/libkvm/kvm_proc.c
@@ -413,7 +413,7 @@ kvm_getprocs(kd, op, arg, cnt)
kd->procbase->ki_structsize);
return (0);
}
- nprocs = size / kd->procbase->ki_structsize;
+ nprocs = size == 0 ? 0 : size / kd->procbase->ki_structsize;
} else {
struct nlist nl[4], *p;