From 8acd12764097294d4ec51f02787594eb2c517084 Mon Sep 17 00:00:00 2001 From: paul-szczepanek-arm <33840200+paul-szczepanek-arm@users.noreply.github.com> Date: Tue, 13 Aug 2019 14:49:18 +0100 Subject: [PATCH] handle early termination of ad struct --- features/FEATURE_BLE/ble/gap/AdvertisingDataParser.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/features/FEATURE_BLE/ble/gap/AdvertisingDataParser.h b/features/FEATURE_BLE/ble/gap/AdvertisingDataParser.h index 53fbe23e31..c0559f1bff 100644 --- a/features/FEATURE_BLE/ble/gap/AdvertisingDataParser.h +++ b/features/FEATURE_BLE/ble/gap/AdvertisingDataParser.h @@ -69,6 +69,11 @@ public: if (position >= data.size()) { return false; } + + /* early termination of packet, no more meaningful octets */ + if (current_length() == 0) { + return false; + } if (position + current_length() >= data.size()) { return false;