diff --git a/features/FEATURE_BLE/source/gap/AdvertisingDataBuilder.cpp b/features/FEATURE_BLE/source/gap/AdvertisingDataBuilder.cpp index 5c23ad03d3..0764688e83 100644 --- a/features/FEATURE_BLE/source/gap/AdvertisingDataBuilder.cpp +++ b/features/FEATURE_BLE/source/gap/AdvertisingDataBuilder.cpp @@ -498,7 +498,7 @@ ble_error_t AdvertisingDataBuilder::setUUIDData( size_t old_size = getFieldSize(shortType) + getFieldSize(longType); /* if we can't fit the new data do not proceed */ - if (new_size > data.size() - (_payload_length - old_size)) { + if (new_size > _buffer.size() - (_payload_length - old_size)) { return BLE_ERROR_BUFFER_OVERFLOW; }