summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Henningsson <david.henningsson@canonical.com>2013-06-10 16:42:47 +0200
committerJaroslav Kysela <perex@perex.cz>2013-06-14 14:09:55 +0200
commitc91785e002b96afad344a8ab182e8d33e355b7f7 (patch)
treebd60d52aa38843663a723a6724981da42e760b69
parentd20e24e5d1614354e9c8195ed0b11fe089c489e4 (diff)
downloadalsa-lib-c91785e002b96afad344a8ab182e8d33e355b7f7.tar.gz
pcm_hw: Fix buffer overflow in chmap
We can't calculate memory storage in bytes, when we're supposed to store ints in it! Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rw-r--r--src/pcm/pcm_hw.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c
index 196393d0..9ff83a92 100644
--- a/src/pcm/pcm_hw.c
+++ b/src/pcm/pcm_hw.c
@@ -1187,7 +1187,7 @@ static snd_pcm_chmap_t *snd_pcm_hw_get_chmap(snd_pcm_t *pcm)
snd_pcm_state_name(FAST_PCM_STATE(hw)));
return NULL;
}
- map = malloc(pcm->channels + 1);
+ map = malloc(pcm->channels * sizeof(map->pos[0]) + sizeof(*map));
if (!map)
return NULL;
map->channels = pcm->channels;