diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2007-01-07 13:35:52 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2007-01-07 13:35:52 +0000 |
commit | 155750bb17fefa4b53f763fcb21683c1cc23ab62 (patch) | |
tree | c007ce11208e31c8da8a6e4de196ee90fb6582f5 /sys | |
parent | 7d98d7a8f4a249310c73cd8056898c22d0f1d150 (diff) |
Protect against zero blocksize (causing a divide by zero) in audiogetinfo().
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/audio.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/dev/audio.c b/sys/dev/audio.c index 45c3c903b6f..629b728de44 100644 --- a/sys/dev/audio.c +++ b/sys/dev/audio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: audio.c,v 1.53 2006/11/29 13:34:31 miod Exp $ */ +/* $OpenBSD: audio.c,v 1.54 2007/01/07 13:35:51 miod Exp $ */ /* $NetBSD: audio.c,v 1.119 1999/11/09 16:50:47 augustss Exp $ */ /* @@ -2894,9 +2894,12 @@ audiogetinfo(sc, ai) p->buffer_size = sc->sc_pr.bufsize; r->buffer_size = sc->sc_rr.bufsize; - ai->blocksize = sc->sc_pr.blksize; - ai->hiwat = sc->sc_pr.usedhigh / sc->sc_pr.blksize; - ai->lowat = sc->sc_pr.usedlow / sc->sc_pr.blksize; + if ((ai->blocksize = sc->sc_pr.blksize) != 0) { + ai->hiwat = sc->sc_pr.usedhigh / sc->sc_pr.blksize; + ai->lowat = sc->sc_pr.usedlow / sc->sc_pr.blksize; + } else { + ai->hiwat = ai->lowat = 0; + } ai->mode = sc->sc_mode; return (0); |