From: Anderson Lizardo Date: Fri, 19 Jul 2013 17:34:16 +0000 (-0400) Subject: attrib: Allow dec_read_resp() to just check if PDU is valid X-Git-Tag: android-x86-4.4-r3~7837 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=638790716fa36c221f35bd2639754b6d43798741;p=android-x86%2Fexternal-bluetooth-bluez.git attrib: Allow dec_read_resp() to just check if PDU is valid If a NULL "value" parameter is given, only check whether PDU is valid, without copying attribute value to a buffer. --- diff --git a/attrib/att.c b/attrib/att.c index d5f4f68e1..753c75398 100644 --- a/attrib/att.c +++ b/attrib/att.c @@ -704,12 +704,12 @@ ssize_t dec_read_resp(const uint8_t *pdu, size_t len, uint8_t *value, if (pdu == NULL) return -EINVAL; - if (value == NULL) - return -EINVAL; - if (pdu[0] != ATT_OP_READ_RESP) return -EINVAL; + if (value == NULL) + return len - 1; + if (vlen < (len - 1)) return -ENOBUFS;