From 638790716fa36c221f35bd2639754b6d43798741 Mon Sep 17 00:00:00 2001 From: Anderson Lizardo Date: Fri, 19 Jul 2013 13:34:16 -0400 Subject: [PATCH] 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. --- attrib/att.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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; -- 2.47.3