summaryrefslogtreecommitdiff
path: root/client/gatt.c
diff options
context:
space:
mode:
authorGrzegorz Kolodziejczyk <grzegorz.kolodziejczyk@codecoup.pl>2018-03-20 15:05:18 +0100
committerSzymon Janc <szymon.janc@codecoup.pl>2018-03-21 10:47:07 +0100
commitbc6facb0cfcfa3098b57f93919b69e7ffb204f04 (patch)
tree36b9b1d53152e0b3c52e9b24e6ab9857717e18a5 /client/gatt.c
parent4c22678e960a5bd89aed0717cc6ef863467b9014 (diff)
downloadbluez-bc6facb0cfcfa3098b57f93919b69e7ffb204f04.tar.gz
client: Update read callbacks with invalid offset error handlers
This patch adds invalid offset handlers to read callbacks of attributes.
Diffstat (limited to 'client/gatt.c')
-rw-r--r--client/gatt.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/client/gatt.c b/client/gatt.c
index 7a6035ac1..3fa490b1a 100644
--- a/client/gatt.c
+++ b/client/gatt.c
@@ -1473,6 +1473,10 @@ static DBusMessage *chrc_read_value(DBusConnection *conn, DBusMessage *msg,
parse_offset(&iter, &offset);
+ if (offset > chrc->value_len)
+ return g_dbus_create_error(msg, "org.bluez.Error.InvalidOffset",
+ NULL);
+
return read_value(msg, &chrc->value[offset], chrc->value_len - offset);
}
@@ -1831,6 +1835,10 @@ static DBusMessage *desc_read_value(DBusConnection *conn, DBusMessage *msg,
parse_offset(&iter, &offset);
+ if (offset > desc->value_len)
+ return g_dbus_create_error(msg, "org.bluez.Error.InvalidOffset",
+ NULL);
+
return read_value(msg, &desc->value[offset], desc->value_len - offset);
}