Skip to contentSkip to conversation

Fix error code in case of invalid offset

PATCH In review Klein, Thorsten (BSH) 3 participants 5 messages Apr 3, 2020 – Apr 6, 2020 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix error code in case of invalid offset

Fix dbus error code in case of invalid offset (org.bluez.Error.InvalidOffset).

Ryll, Jan (BSH) (1):
fix dbus error code in case of invalid offset
(org.bluez.Error.InvalidOffset)

 client/gatt.c | 4 ++++
 1 file changed, 4 insertions(+)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 fix dbus error code in case of invalid offset (org.bluez.Error.InvalidOffset)

From: "Ryll, Jan (BSH)" <[email protected]>

---
 client/gatt.c | 4 ++++
 1 file changed, 4 insertions(+)
client/gatt.c +4 -0
index 416eda9..cf2cb17 100644
@@ -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,
Signature · 1 line
2.7.4
#2 lore raw

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

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>

Quoted 25 lines · Thorsten (BSH)

From: "Ryll, Jan (BSH)" <[email protected]>

---
 client/gatt.c | 4 ++++
 1 file changed, 4 insertions(+)
client/gatt.c +4 -1
index 416eda9..cf2cb17 100644
@@ -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

Signature · 1 line
Luiz Augusto von Dentz
#3 lore raw
In reply to Klein, Thorsten (BSH)

Hi Thorsten,

Quoted 7 lines · Thorsten (BSH)

Fix dbus error code in case of invalid offset (org.bluez.Error.InvalidOffset).

Ryll, Jan (BSH) (1):
fix dbus error code in case of invalid offset
(org.bluez.Error.InvalidOffset)

Quoted 5 lines
 client/gatt.c | 4 ++++
 1 file changed, 4 insertions(+)

--
2.7.4

Something is missing here.

Signature · 1 line
Luiz Augusto von Dentz
#4 lore raw

Hi Luiz,

what is missing?

Regards
Jan

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Luiz Augusto von Dentz
Sent: Friday, April 3, 2020 11:43 PM
To: Klein, Thorsten (BSH) <[email protected]>
Cc: [email protected]; Klein, Thorsten (GED-SDD2) <[email protected]>
Subject: Re: [PATCH BlueZ] Fix error code in case of invalid offset

Hi Thorsten,

Quoted 7 lines · Thorsten (BSH)

Fix dbus error code in case of invalid offset (org.bluez.Error.InvalidOffset).

Ryll, Jan (BSH) (1):
fix dbus error code in case of invalid offset
(org.bluez.Error.InvalidOffset)

Quoted 5 lines
 client/gatt.c | 4 ++++
 1 file changed, 4 insertions(+)

--
2.7.4

Something is missing here.

--
Luiz Augusto von Dentz