diff --git a/internal/platform/implementation/windows/bluetooth_adapter.cc b/internal/platform/implementation/windows/bluetooth_adapter.cc index cffe1662..8925f032 100644 --- a/internal/platform/implementation/windows/bluetooth_adapter.cc +++ b/internal/platform/implementation/windows/bluetooth_adapter.cc @@ -246,6 +246,13 @@ std::string BluetoothAdapter::GetName() const { // https://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html#setName(java.lang.String) bool BluetoothAdapter::SetName(absl::string_view name) { + if (name.size() > 70 * sizeof(char)) { + NEARBY_LOGS(ERROR) << __func__ + << ": Failed to set name for bluetooth adapter because " + "the name exceeded the 70 bytes limit for Windows."; + return false; + } + std::string instance_id(GetGenericBluetoothAdapterInstanceID()); if (instance_id.empty()) {