2017-11-02 07:46:33

by ERAMOTO Masaya

[permalink] [raw]
Subject: [PATCH BlueZ 1/2] client: Fix clearing advertising service data

Even if running set-advertise-manufacturer with data having an invalid
value, client does not clear the advertising service data and clears the
advertising manufacturer data.
---
client/advertising.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/client/advertising.c b/client/advertising.c
index 7e4bb3643..76eda3c97 100644
--- a/client/advertising.c
+++ b/client/advertising.c
@@ -517,7 +517,7 @@ void ad_advertise_manufacturer(DBusConnection *conn, const char *arg)
val = strtol(w.we_wordv[i], &endptr, 0);
if (!endptr || *endptr != '\0' || val > UINT8_MAX) {
rl_printf("Invalid value at index %d\n", i);
- ad_clear_service();
+ ad_clear_manufacturer();
goto done;
}

--
2.14.1



2017-11-02 12:08:36

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/2] client: Fix clearing advertising service data

Hi Eramoto,

On Thu, Nov 2, 2017 at 9:46 AM, ERAMOTO Masaya
<[email protected]> wrote:
> Even if running set-advertise-manufacturer with data having an invalid
> value, client does not clear the advertising service data and clears the
> advertising manufacturer data.
> ---
> client/advertising.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/client/advertising.c b/client/advertising.c
> index 7e4bb3643..76eda3c97 100644
> --- a/client/advertising.c
> +++ b/client/advertising.c
> @@ -517,7 +517,7 @@ void ad_advertise_manufacturer(DBusConnection *conn, const char *arg)
> val = strtol(w.we_wordv[i], &endptr, 0);
> if (!endptr || *endptr != '\0' || val > UINT8_MAX) {
> rl_printf("Invalid value at index %d\n", i);
> - ad_clear_service();
> + ad_clear_manufacturer();
> goto done;
> }
>
> --
> 2.14.1

Applied, thanks.

--
Luiz Augusto von Dentz

2017-11-02 07:50:32

by ERAMOTO Masaya

[permalink] [raw]
Subject: [PATCH BlueZ 2/2] client: Clear ad manufacturer/service data when too much data

When data is too much, the data may include values not making sense, so
this patch clears the advertising manufacturer/service data corresponding
to the running command.
---
client/advertising.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/client/advertising.c b/client/advertising.c
index 76eda3c97..e950aa278 100644
--- a/client/advertising.c
+++ b/client/advertising.c
@@ -456,6 +456,7 @@ void ad_advertise_service(DBusConnection *conn, const char *arg)

if (i >= G_N_ELEMENTS(data->data)) {
rl_printf("Too much data\n");
+ ad_clear_service();
goto done;
}

@@ -511,6 +512,7 @@ void ad_advertise_manufacturer(DBusConnection *conn, const char *arg)
for (i = 1; i < w.we_wordc; i++) {
if (i >= G_N_ELEMENTS(data->data)) {
rl_printf("Too much data\n");
+ ad_clear_manufacturer();
goto done;
}

--
2.14.1