From: Szymon Janc <szymon.janc@tieto.com>
To: Jakub Tyszkowski <jakub.tyszkowski@tieto.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 2/2] android/gatt: Report error on invalid value length for CCC descriptor
Date: Thu, 18 Dec 2014 11:47:43 +0100 [thread overview]
Message-ID: <18922032.OiTWhopxOi@uw000953> (raw)
In-Reply-To: <1418731357-8531-2-git-send-email-jakub.tyszkowski@tieto.com>
Hi Jakub,
On Tuesday 16 of December 2014 13:02:37 Jakub Tyszkowski wrote:
> For application services, characteristics and descriptors it's user app's
> responsibility to verify value length but for embeded ones we need to do
> this in daemon. This is checked in TC_GAW_SR_BI_34_C and PTS tries to
> write to embeded CCC descritor if no other descriptors are added by the
> apps. It is expected by PTS for us to be more strict about value length
> controll.
> ---
> android/gatt.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/android/gatt.c b/android/gatt.c
> index 1e2627b..5f2f1c4 100644
> --- a/android/gatt.c
> +++ b/android/gatt.c
> @@ -6958,6 +6958,13 @@ static void gatt_srvc_change_write_cb(struct gatt_db_attribute *attrib,
> return;
> }
>
> + /* No more than 2 octets are expected */
> + if (len > 2) {
> + gatt_db_attribute_write_result(attrib, id,
> + ATT_ECODE_INVAL_ATTR_VALUE_LEN);
> + return;
> + }
> +
I think we should check if len == 2 here and use get_le16()
and pass u16 to bt_store_gatt_ccc() (instead of u8 as will *value).
> /* Set services changed indication value */
> bt_store_gatt_ccc(bdaddr, *value);
>
>
--
Best regards,
Szymon Janc
next prev parent reply other threads:[~2014-12-18 10:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-16 12:02 [PATCH 1/2] android/gatt: Fix embeded services not responsing to some requests Jakub Tyszkowski
2014-12-16 12:02 ` [PATCH 2/2] android/gatt: Report error on invalid value length for CCC descriptor Jakub Tyszkowski
2014-12-18 10:47 ` Szymon Janc [this message]
2014-12-18 10:02 ` [PATCH 1/2] android/gatt: Fix embeded services not responsing to some requests Szymon Janc
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=18922032.OiTWhopxOi@uw000953 \
--to=szymon.janc@tieto.com \
--cc=jakub.tyszkowski@tieto.com \
--cc=linux-bluetooth@vger.kernel.org \
/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