diff options
author | peter <peter@FreeBSD.org> | 1996-08-24 03:24:39 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1996-08-24 03:24:39 +0000 |
commit | 8451e2f0fc6ff7a4beb55f818a36fdec290c8b43 (patch) | |
tree | 2e884e13ef4ac2058653734eba99da3ee4f1aa30 /sys/i386/isa/spkr.c | |
parent | ee3725a1c173b071322f7e3fa3fb70de6f6e41d2 (diff) | |
download | FreeBSD-src-8451e2f0fc6ff7a4beb55f818a36fdec290c8b43.zip FreeBSD-src-8451e2f0fc6ff7a4beb55f818a36fdec290c8b43.tar.gz |
Unconditionally null-terminate string read into spkr driver.
Submitted by: Ikuo Nakagawa <ikuo@isl.intec.co.jp>, PR#1488, but using
Bruce Evans <bde@zeta.org.au>'s fix.
Diffstat (limited to 'sys/i386/isa/spkr.c')
-rw-r--r-- | sys/i386/isa/spkr.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/i386/isa/spkr.c b/sys/i386/isa/spkr.c index 97280b1..f05e5a1 100644 --- a/sys/i386/isa/spkr.c +++ b/sys/i386/isa/spkr.c @@ -4,7 +4,7 @@ * v1.4 by Eric S. Raymond (esr@snark.thyrsus.com) Aug 1993 * modified for FreeBSD by Andrew A. Chernov <ache@astral.msk.su> * - * $Id: spkr.c,v 1.24 1996/03/27 19:07:33 bde Exp $ + * $Id: spkr.c,v 1.25 1996/07/20 18:48:54 joerg Exp $ */ #include "speaker.h" @@ -514,7 +514,7 @@ spkrwrite(dev, uio, ioflag) if (minor(dev) != 0) return(ENXIO); - else if (uio->uio_resid > DEV_BSIZE) /* prevent system crashes */ + else if (uio->uio_resid > (DEV_BSIZE - 1)) /* prevent system crashes */ return(E2BIG); else { @@ -524,8 +524,11 @@ spkrwrite(dev, uio, ioflag) n = uio->uio_resid; cp = spkr_inbuf->b_un.b_addr; - if (!(error = uiomove(cp, n, uio))) + error = uiomove(cp, n, uio); + if (!error) { + cp[n] = '\0'; playstring(cp, n); + } return(error); } } |