diff mbox series

[BlueZ] fix dbus error code in case of invalid offset (org.bluez.Error.InvalidOffset)

Message ID 1585899568-14564-2-git-send-email-thorsten.klein@bshg.com (mailing list archive)
State New, archived
Headers show
Series [BlueZ] fix dbus error code in case of invalid offset (org.bluez.Error.InvalidOffset) | expand

Commit Message

Klein, Thorsten (BSH) April 3, 2020, 7:39 a.m. UTC
From: "Ryll, Jan (BSH)" <jan.ryll@bshg.com>

---
 client/gatt.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Luiz Augusto von Dentz April 3, 2020, 9:34 p.m. UTC | #1
Hi Thorsten,

You may want to fix the commit message to state that this is for the
client, e.g.

client: Fix not sending InvalidOffset

...<some description why it is needed>

On Fri, Apr 3, 2020 at 12:42 AM Klein, Thorsten (BSH)
<kleinkastel@googlemail.com> wrote:
>
> From: "Ryll, Jan (BSH)" <jan.ryll@bshg.com>
>
> ---
>  client/gatt.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/client/gatt.c b/client/gatt.c
> index 416eda9..cf2cb17 100644
> --- a/client/gatt.c
> +++ b/client/gatt.c
> @@ -2276,6 +2276,10 @@ static DBusMessage *chrc_write_value(DBusConnection *conn, DBusMessage *msg,
>         if (prep_authorize)
>                 return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
>
> +    if (offset >= (chrc->max_val_len))
> +        return g_dbus_create_error(msg,
> +                               "org.bluez.Error.InvalidOffset", NULL);
> +
>         if (write_value(&chrc->value_len, &chrc->value, value, value_len,
>                                                 offset, chrc->max_val_len))
>                 return g_dbus_create_error(msg,
> --
> 2.7.4
>
diff mbox series

Patch

diff --git a/client/gatt.c b/client/gatt.c
index 416eda9..cf2cb17 100644
--- a/client/gatt.c
+++ b/client/gatt.c
@@ -2276,6 +2276,10 @@  static DBusMessage *chrc_write_value(DBusConnection *conn, DBusMessage *msg,
 	if (prep_authorize)
 		return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
 
+    if (offset >= (chrc->max_val_len))
+        return g_dbus_create_error(msg,
+				"org.bluez.Error.InvalidOffset", NULL);
+
 	if (write_value(&chrc->value_len, &chrc->value, value, value_len,
 						offset, chrc->max_val_len))
 		return g_dbus_create_error(msg,