2014-01-13 12:53:47

by Andrzej Kaczmarek

[permalink] [raw]
Subject: [PATCH] android/a2dp: Fix buffer size calculation for codec caps

---
android/a2dp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/android/a2dp.c b/android/a2dp.c
index 05edd71..1f7678a 100644
--- a/android/a2dp.c
+++ b/android/a2dp.c
@@ -415,7 +415,7 @@ static gboolean sep_getcap_ind(struct avdtp *session,
service = avdtp_service_cap_new(AVDTP_MEDIA_TRANSPORT, NULL, 0);
*caps = g_slist_append(*caps, service);

- codec = g_malloc0(sizeof(*codec) + sizeof(cap->len));
+ codec = g_malloc0(sizeof(*codec) + cap->len);
codec->media_type = AVDTP_MEDIA_TYPE_AUDIO;
codec->media_codec_type = endpoint->codec;
memcpy(codec->data, cap->data, cap->len);
--
1.8.5.2



2014-01-13 13:11:22

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH] android/a2dp: Fix buffer size calculation for codec caps

Hi Andrzej,

On Mon, Jan 13, 2014 at 2:53 PM, Andrzej Kaczmarek
<[email protected]> wrote:
> ---
> android/a2dp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/android/a2dp.c b/android/a2dp.c
> index 05edd71..1f7678a 100644
> --- a/android/a2dp.c
> +++ b/android/a2dp.c
> @@ -415,7 +415,7 @@ static gboolean sep_getcap_ind(struct avdtp *session,
> service = avdtp_service_cap_new(AVDTP_MEDIA_TRANSPORT, NULL, 0);
> *caps = g_slist_append(*caps, service);
>
> - codec = g_malloc0(sizeof(*codec) + sizeof(cap->len));
> + codec = g_malloc0(sizeof(*codec) + cap->len);
> codec->media_type = AVDTP_MEDIA_TYPE_AUDIO;
> codec->media_codec_type = endpoint->codec;
> memcpy(codec->data, cap->data, cap->len);
> --
> 1.8.5.2

Applied, thanks.


--
Luiz Augusto von Dentz