summaryrefslogtreecommitdiffstats
path: root/stack/gatt/gatt_auth.c
diff options
context:
space:
mode:
Diffstat (limited to 'stack/gatt/gatt_auth.c')
-rw-r--r--stack/gatt/gatt_auth.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/stack/gatt/gatt_auth.c b/stack/gatt/gatt_auth.c
index ae5214592..89e2cc1cd 100644
--- a/stack/gatt/gatt_auth.c
+++ b/stack/gatt/gatt_auth.c
@@ -103,6 +103,11 @@ void gatt_verify_signature(tGATT_TCB *p_tcb, BT_HDR *p_buf)
UINT8 *p, *p_orig = (UINT8 *)(p_buf + 1) + p_buf->offset;
UINT32 counter;
+ if (p_buf->len < GATT_AUTH_SIGN_LEN + 4) {
+ GATT_TRACE_ERROR("%s: Data length %u less than expected %u",
+ __func__, p_buf->len, GATT_AUTH_SIGN_LEN + 4);
+ return;
+ }
cmd_len = p_buf->len - GATT_AUTH_SIGN_LEN + 4;
p = p_orig + cmd_len - 4;
STREAM_TO_UINT32(counter, p);