From 23e39a1dbd52ef5f313dddfe4316c0183dc559d7 Mon Sep 17 00:00:00 2001 From: Vincent Coubard Date: Fri, 29 May 2020 15:06:38 +0100 Subject: [PATCH] Fix capacity check when service data are added to BLE advertising payload. --- features/FEATURE_BLE/source/gap/AdvertisingDataBuilder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/FEATURE_BLE/source/gap/AdvertisingDataBuilder.cpp b/features/FEATURE_BLE/source/gap/AdvertisingDataBuilder.cpp index 0764688e83a..14aee492b1e 100644 --- a/features/FEATURE_BLE/source/gap/AdvertisingDataBuilder.cpp +++ b/features/FEATURE_BLE/source/gap/AdvertisingDataBuilder.cpp @@ -256,7 +256,7 @@ ble_error_t AdvertisingDataBuilder::setServiceData( ); /* if we can't fit the new data do not proceed */ - if (total_size > data.size() - (_payload_length - old_size)) { + if (total_size > (_buffer.size() - (_payload_length - old_size))) { return BLE_ERROR_BUFFER_OVERFLOW; }