summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2017-07-19 13:38:06 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2017-07-19 13:38:06 +0000
commit58b2931d8b5fce0a3aae569ed88aca0a07a82812 (patch)
treee96e9763de039530ab5d776ca84f4095eeebc470 /sys
parentc0406b17f86980ac4836e35d191e0695c6e58033 (diff)
Avoid division by zero of vnd_secsize
Found by Ilja Van Sprundel ok claudio kettenis
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/vnd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c
index b7ae5de255f..61f58ae9e7f 100644
--- a/sys/dev/vnd.c
+++ b/sys/dev/vnd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vnd.c,v 1.163 2017/01/21 05:42:04 guenther Exp $ */
+/* $OpenBSD: vnd.c,v 1.164 2017/07/19 13:38:05 deraadt Exp $ */
/* $NetBSD: vnd.c,v 1.26 1996/03/30 23:06:11 christos Exp $ */
/*
@@ -419,6 +419,7 @@ vndioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
/* Geometry eventually has to fit into label fields */
if (vio->vnd_secsize > UINT_MAX ||
+ vio->vnd_secsize == 0 ||
vio->vnd_ntracks > UINT_MAX ||
vio->vnd_nsectors > UINT_MAX)
return (EINVAL);