linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@tieto.com>
To: Marcin Kraglak <marcin.kraglak@tieto.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCHv3 1/2] android/client: Fix incorrect data parsing
Date: Tue, 26 Aug 2014 15:21:09 +0200	[thread overview]
Message-ID: <6050899.WYRYWitLqa@uw000953> (raw)
In-Reply-To: <1409048454-16116-1-git-send-email-marcin.kraglak@tieto.com>

Hi Marcin,

On Tuesday 26 of August 2014 12:20:53 Marcin Kraglak wrote:
> Use fill_buffer function in processing write_characteristic
> and send_indication functions.
> ---
>  android/client/if-gatt.c | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/android/client/if-gatt.c b/android/client/if-gatt.c
> index 8154bfd..1d8def2 100644
> --- a/android/client/if-gatt.c
> +++ b/android/client/if-gatt.c
> @@ -1191,11 +1191,12 @@ static void write_characteristic_p(int argc, const char **argv)
>  		return;
>  	}
>  
> -	/* len in chars */
> -	len = strlen(argv[6]);
> -	scan_field(argv[6], len, value, sizeof(value));
> -	/* len in bytes converted from ascii chars */
> -	len = (len + 1) / 2;
> +	if (argv[6][0] != '0' || (argv[6][1] != 'X' && argv[6][1] != 'x')) {
> +		haltest_error("Value must be hex string");
> +		return;
> +	}
> +
> +	len = fill_buffer(argv[6] + 2, value, sizeof(value));
>  
>  	/* auth_req */
>  	if (argc > 7)
> @@ -1791,8 +1792,13 @@ static void gatts_send_indication_p(int argc, const char *argv[])
>  	confirm = atoi(argv[5]);
>  
>  	if (argc > 6) {
> -		len = strlen(argv[6]);
> -		scan_field(argv[6], len, (uint8_t *) data, sizeof(data));
> +		if (argv[6][0] != '0' ||
> +				(argv[6][1] != 'X' && argv[6][1] != 'x')) {
> +			haltest_error("Value must be hex string");
> +			return;
> +		}
> +
> +		len = fill_buffer(argv[6] + 2, (uint8_t *) data, sizeof(data));
>  	}
>  
>  	EXEC(if_gatt->server->send_indication, server_if, attr_handle, conn_id,
> 

Both patches applied, thanks.

-- 
Best regards, 
Szymon Janc

      parent reply	other threads:[~2014-08-26 13:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-26 10:20 [PATCHv3 1/2] android/client: Fix incorrect data parsing Marcin Kraglak
2014-08-26 10:20 ` [PATCHv3 2/2] android/pts: Update PTS GATT test results Marcin Kraglak
2014-08-26 13:21 ` Szymon Janc [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=6050899.WYRYWitLqa@uw000953 \
    --to=szymon.janc@tieto.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcin.kraglak@tieto.com \
    /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;
as well as URLs for NNTP newsgroup(s).