From: Takashi Iwai <tiwai@suse.de>
To: Anssi Hannula <anssi.hannula@iki.fi>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH] pcm: fix buffer overflow in snd_pcm_chmap_print()
Date: Wed, 31 Dec 2014 10:03:06 +0100 [thread overview]
Message-ID: <s5hfvbwgpit.wl-tiwai@suse.de> (raw)
In-Reply-To: <1419965171-23403-1-git-send-email-anssi.hannula@iki.fi>
At Tue, 30 Dec 2014 20:46:11 +0200,
Anssi Hannula wrote:
>
> The size argument is wrong for one of the snprintf() calls in
> snd_pcm_chmap_print(), allowing an overflow to happen (the user-provided
> buffer may be written data up to 2x its actual size).
>
> Seen in an user report here: http://trac.kodi.tv/ticket/15641
>
> Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Thanks, applied.
Takashi
> ---
> src/pcm/pcm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c
> index baa47c7..e74e02f 100644
> --- a/src/pcm/pcm.c
> +++ b/src/pcm/pcm.c
> @@ -7621,7 +7621,7 @@ int snd_pcm_chmap_print(const snd_pcm_chmap_t *map, size_t maxlen, char *buf)
> return -ENOMEM;
> }
> if (map->pos[i] & SND_CHMAP_DRIVER_SPEC)
> - len += snprintf(buf + len, maxlen, "%d", p);
> + len += snprintf(buf + len, maxlen - len, "%d", p);
> else {
> const char *name = chmap_names[p];
> if (name)
> --
> 1.8.4.5
>
prev parent reply other threads:[~2014-12-31 9:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-30 18:46 [PATCH] pcm: fix buffer overflow in snd_pcm_chmap_print() Anssi Hannula
2014-12-31 9:03 ` Takashi Iwai [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s5hfvbwgpit.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=anssi.hannula@iki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox