summaryrefslogtreecommitdiff
path: root/usr.bin/sndiod/dev.c
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2013-02-26 22:52:09 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2013-02-26 22:52:09 +0000
commit97580c983fb716ef44b8bab65ce8350454ee780d (patch)
tree5dfae1991b709c7a9bc85b2e120f844464c2df76 /usr.bin/sndiod/dev.c
parentc07ee48d58400396f4756a3a842e375f8b0189c2 (diff)
Encoding conversion buffer size is one stream block, not one device
block. Fix crashes occuring when the client sample frequency is much larger than the device sample frequency. Found by Alexander Polakov, thanks. ok deraadt@
Diffstat (limited to 'usr.bin/sndiod/dev.c')
-rw-r--r--usr.bin/sndiod/dev.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/sndiod/dev.c b/usr.bin/sndiod/dev.c
index d41d6909149..c7243b5093e 100644
--- a/usr.bin/sndiod/dev.c
+++ b/usr.bin/sndiod/dev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dev.c,v 1.3 2012/11/30 20:44:31 ratchov Exp $ */
+/* $OpenBSD: dev.c,v 1.4 2013/02/26 22:52:08 ratchov Exp $ */
/*
* Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org>
*
@@ -1689,7 +1689,7 @@ slot_attach(struct slot *s)
if (!aparams_native(&s->par)) {
dec_init(&s->mix.dec, &s->par, slot_nch);
s->mix.decbuf =
- xmalloc(d->round * slot_nch * sizeof(adata_t));
+ xmalloc(s->round * slot_nch * sizeof(adata_t));
}
if (s->rate != d->rate) {
resamp_init(&s->mix.resamp, s->round, d->round,
@@ -1728,7 +1728,7 @@ slot_attach(struct slot *s)
if (!aparams_native(&s->par)) {
enc_init(&s->sub.enc, &s->par, slot_nch);
s->sub.encbuf =
- xmalloc(d->round * slot_nch * sizeof(adata_t));
+ xmalloc(s->round * slot_nch * sizeof(adata_t));
}
/*