mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 22:56:12 -04:00
Add size limit check for Bluetooth Classic SetName
PiperOrigin-RevId: 455442872
This commit is contained in:
committed by
Copybara-Service
parent
320d4437ca
commit
6bd1a78eeb
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user