summaryrefslogtreecommitdiff
path: root/attrib/att.c
diff options
context:
space:
mode:
authorAnderson Lizardo <anderson.lizardo@openbossa.org>2010-10-04 15:13:04 -0400
committerJohan Hedberg <johan.hedberg@nokia.com>2010-10-04 21:15:56 +0200
commit6352f7b918d21ff93cc1ea9b031160c7cee3df81 (patch)
treeb6b8c53822b011d09a76d57b0780fe244141fb38 /attrib/att.c
parentdbad6fdb755201d9aa8841ab01050ce27a3c0b33 (diff)
downloadbluez-6352f7b918d21ff93cc1ea9b031160c7cee3df81.tar.gz
Modify dec_read_req() to get PDU length as parameter
This is consistent with other att.h functions, and allows length checks.
Diffstat (limited to 'attrib/att.c')
-rw-r--r--attrib/att.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/attrib/att.c b/attrib/att.c
index b18e1d636..2ffa8ce37 100644
--- a/attrib/att.c
+++ b/attrib/att.c
@@ -379,7 +379,7 @@ uint16_t enc_read_req(uint16_t handle, uint8_t *pdu, int len)
return min_len;
}
-uint16_t dec_read_req(const uint8_t *pdu, uint16_t *handle)
+uint16_t dec_read_req(const uint8_t *pdu, int len, uint16_t *handle)
{
const uint16_t min_len = sizeof(pdu[0]) + sizeof(*handle);
@@ -389,6 +389,9 @@ uint16_t dec_read_req(const uint8_t *pdu, uint16_t *handle)
if (handle == NULL)
return 0;
+ if (len < min_len)
+ return 0;
+
if (pdu[0] != ATT_OP_READ_REQ)
return 0;