diff --git a/sys/dev/speaker/spkr.c b/sys/dev/speaker/spkr.c index 97280b16ac0f..f05e5a1da006 100644 --- a/sys/dev/speaker/spkr.c +++ b/sys/dev/speaker/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 * - * $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); } } diff --git a/sys/i386/isa/spkr.c b/sys/i386/isa/spkr.c index 97280b16ac0f..f05e5a1da006 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 * - * $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); } }